C :: Address Family Not Supported By Protocol In Socket Programming In Linux

Oct 31, 2013

I am writing on C simple socket programs in Linux. I wrote client and server C programs. My client program is Code: #include<sys/socket.h>//for socket(), connect(), sendto() and recvform()

#include<sys/types.h>
#include<netinet/in.h>
#include<netdb.h>
#include<stdio.h>// for printf() and fprintf()

[Code]....

I am just testing whether can connect or not. I run server program first and client later. But when I run client, it showed that "Address family not supported by protocol".

View 3 Replies


ADVERTISEMENT

C/C++ :: TCPIP Socket Client Programming In Redhat Linux Using Eclipse CDT

Mar 16, 2014

This is my sample socket tcp ip program , problem here is when i give working ip address and port number, it is showing default ip address as 127.0.0.1 and it is Waiting on (1978=port number) i.e., "connection on %d...", SERVER_PORT.

void socket_server_demo(void){
int iserver_socket = -1;
int iclient_socket = -1;
unsigned char bTemp[1024];
unsigned int iTemp = 0;

[Code] ....

View 1 Replies View Related

C++ :: UDP Socket Library On Linux

Jan 29, 2014

I'm attempting to write a little UDP socket library in c++ on linux so a user can just create a new instance of a UDPSocket class, specify destination ip and port, and just connect. Then the user should be able to call send() or receive() in any order they want.. and here I encounter a little problem..

Most of the tutorials for udp socket sending out there include a bind() call when you create your "server" that is supposed to receive data, but the code that send data does not need one. Because I also want my library to support unicast/broadcast/multicast, I have read that I need to set the socket option SO_REUSEADDR on my sockets (since multiple sockets will need to be connected to same destination IP/port for broadcast/multicast)

My question is.. do I need to create 2 socket handles per "UDPSocke in order to make this work? One for sending and one for receiving data? In my code when I try to work with only 1 socket, it is only able to receive stuff from itself on unicast.. Or should I just remove the SO_REUSEADDR when in unicast mode, then try to bind with both sockets, accept that the bind will only work on the 1st socket, and take it from there?

View 1 Replies View Related

C :: UDO Socket Programming

Dec 18, 2014

I am trying to test my client-server socket program wherein the client connects to the server,client sends a message, server receives it and echo back to the client.So far, in the program server receives the message from the client, prints it BUT when it tries to send the message back to the client it shows an error.

sendto(): Invalid argument.I am new to socket programming.

Code:

//Server
#include<stdio.h> //printf
#include<string.h> //memset
#include<stdlib.h> //exit(0)
#include<netinet/in.h>
#include<sys/socket.h>
#define BUFLEN 512 //Max length of buffer
#define PORT 10003 //The port on which to listen for incoming data
}

[code]....

View 3 Replies View Related

C :: Socket Programming Getting Segfault

May 22, 2013

I am trying to send a packet across a client/server communication. I am getting a seg fault (while running the program(It compiles fine)) when I try to read the neighbor file, You should be able to see this below the comment /***** Read neighbor file***/ :

Code:

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
}

[code]....

View 2 Replies View Related

C/C++ :: Sending And Receiving Struct Over TCP Socket In Linux

Apr 4, 2012

I am trying to code a C program for sending a struct over TCP Socket in Linux! The code is as follows:

/*
** sravan_server.c - a stream socket (TCP) server Program 
*/
#include <stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<errno.h>
#include<string.h>

[Code] ....

View 4 Replies View Related

C :: Socket Programming And Console Control

Jan 4, 2014

I would like to make a program for final project, which can let me send any file to my computer at home, and i can access any files in my computer when i am not at home.sending and getting file will be with socket programming.

i would like to reach all folders in computer, not only the folder, where client program exist. how can i access other folders at remote computer by using my program?

View 4 Replies View Related

C :: Linux Socket Multiple Connections But With Different Time Rate

Feb 6, 2015

i want to write a server and a client as below:

The server(and not the clients) will connect to the clients and just send a message. The idea is to be able to connect at each client a different time.

e.g
every 10mins connect at client 1
every 2mins connect at client 2
every 1hour connect at client 3
and so on...

So how to implement this ? Should i create a new child process for each connection and what about the timing ? A pseudo code also will work.

View 4 Replies View Related

C :: Netstat And PS Commands For Client / Server Socket Programming

Mar 3, 2013

I made client server program with fork ,without using signal handler because I want to see the status zombie for parent server, but when i execute "ps" command i didn't see anything for server or client pid or ppid ,i wonder about how to show the server and client process coz when i execute commad "ps" i saw only ps and bash processes???

View 1 Replies View Related

C :: Socket Programming Support Multiple Ports - Defined Variables

Sep 3, 2013

I want to put my socket programming example of how it can support multiple ports. I want to make the process more requests from distributing particles to create non-blocking structure

ports support ports defined variable.

Code:
#include "stdio.h"
#include "stdlib.h"
#include "unistd.h"
#include "errno.h"
#include "string.h"
#include "sys/socket.h"

[Code] .....

View 2 Replies View Related

C++ :: Why Address Of Object Is 6 Bytes And Not 8 Bytes On 64 Bit Linux

Mar 24, 2013

Code:
int i12 = 1001;
cout << i12 << " " << &i12 << endl;

gives the result: 0x7fff0d065098

It's 6 bytes, but I'd expect the address to be 8 bytes on my 64 bit machine. I am using Ubuntu 12.04, GNU compiler.

So, why the address is 6 bytes and not 8 bytes?

View 10 Replies View Related

Visual C++ :: Make Transition From Console Programming To GUI Programming?

Nov 30, 2013

my a book or website where I can make a transition from console programming to GUI programming. I'm totally confused about this. I know how to program in console and can make a whole program based on console. I also know the OPP programming, but it's clear that nobody uses console programming anymore.

View 10 Replies View Related

C++ :: Member Function Prototypes Not Supported

May 4, 2013

I am working with a limited compiler (information you may need to know, I don't really know) and I made this function

Code:
void Swap(int &a , int &b); {
Destination temp;
temp = list[a];
list[a] = list[b];
list[b] = temp;
}

In the private part of a class and it is giving me the error "Member function prototypes not supported". How do I fix this and what is a member function prototype exactly?

View 3 Replies View Related

C# :: Selection Font Not Supported In A Label?

Aug 24, 2014

I'm trying to transfer the font parameters from a richtextbox to a label but the label doesn't support .SelectionFont.

System.Drawing.Font currentFont = richTextBox.SelectionFont;
System.Drawing.FontStyle newFontStyle;
newFontStyle = FontStyle.Regular;
expanderLabel.SelectionFont = new Font(
currentFont.FontFamily,
currentFont.Size,
newFontStyle
);

View 2 Replies View Related

Visual C++ :: Multiple Dialogs Supported In One Derived CDialog Class?

Apr 14, 2014

In my class:

Code:
class SettingsDialog : public CDialogEx

I have:

Code:
enum { IDD = IDD_SETTINGS_DIALOG };

I have a very similar dialog called IDD_SETTINGS2_DIALOG with all the exact same variables. Is it possible to conditionally load either of those dialogs in that class through a variable pass into the constructor? If so, how do I edit that enum type to add both?

View 2 Replies View Related

C++ ::  Decrypting And Encrypting Following A Certain Protocol?

Mar 26, 2014

I have a certain method of encrypting text. You get the first character of the word. For example in the word "hacker", you get 'h', and then you get the last character 'r'. The encrypted word until now is "hr". Then we get the same word with the 'h' and 'r' removed, now it's "acke". I do the same thing and get the first character 'a' and the last one 'e' and them to the encrypted word: it is now "hrae".

The left letters of the word are "ck", again we do the same thing and take the first character 'c' and the last character 'k' and and add them to the new encrypted word so it is "hraeck". The above word has an even number of characters and at the end had 2 characters left 'c' and 'k',first and last, in some cases of words with an odd number of characters, only one character is left! I'm completely lost on how to encrypt and decrypt this.

View 4 Replies View Related

C++ :: How To Connect To Router Using WPS Protocol

Apr 29, 2013

I own a code written in c++ that is used to connect the router using the WPS protocol, but has to be modified to operate in "registrar" mode and I do not know much about c++.

View 1 Replies View Related

C++ :: UDP Protocol In A Conditional Statement?

Nov 4, 2013

I'm facing a serious problem with udp protocol. I have Master & Slave devices.I did implement the class as the follow pseudo code states

In Master side

while (true)
{
1-send data to slave;
2-get data from slave;
3-apply force;
}

In Slave side

while(true)
{
1-get data from master;
2-if (collision happnes)
send force to the master
}

the problem is in line 2 in Master side. Once I include the line I can't send or receive data. What do you think the problem is?

View 3 Replies View Related

C :: Standard USB Protocol To Follow To Send Data To Embedded Board (and Vice Versa)

Mar 13, 2013

Is there any standard USB protocol which i can follow to send data to my embedded board(and vice versa). I have no clue on USB programming using c,is there any example code i could follow,

View 4 Replies View Related

C# :: Server Application Using Tcp Protocol And Then Establish Connection With A Client Application

Nov 29, 2014

What happens if I make a server application using tcp protocol and then establish connection with a client application but the server crash and then the client send data. Will the data be lost or the system will continue trying to send it?

View 2 Replies View Related

C :: Debugging A Code On Linux OS

Apr 11, 2013

I have a code that I'd like to debugg it.

Question
1 - What is the correct command line to use the debugger ?
2 - Do I need to install additional software for the debugger ?

if yes what it's name?

I use ububtu 12.4compiling command: gcc abc.c -lpthread -o abc

View 3 Replies View Related

C :: Creating Shell In Linux

Feb 22, 2015

This is what so far i did

Code:
#include <stdio.h>#include <string.h>
#include <ctype.h>
#include <bsd/string.h>

int
main(void)

[Code] ....

How to do this Using the fork(), execvp() and waitpid() system calls, launches the requested program and waits until the program has finished.

View 3 Replies View Related

C :: Implementing GUI On Linux Platform

Jul 6, 2014

I am an experience C programmer but never implement GUI.

I need to make a demo implementation that will be run on Linux and will implement GUI.

I searched the WEB and found lot of information, among is implementing the GUI in HTML and run the API through web browser.

How can I make such implementation in C?

View 2 Replies View Related

C :: Compiling 2 Files In Linux Gcc

Sep 22, 2014

I want to use two separate files in 1 program, but cannot get it to work. I don't know if it's my files or the compiling thats wrong. I have never used 2 files in my programs so far. Only used #include <stdio.h>.

Here are my files:
extern_static.c Code: extern int i;
int main(void)
{

[Code]....

View 10 Replies View Related

C :: File Which Can Be Compiled In Linux Via GCC

Aug 16, 2013

I have a c file which can be compiled in Linux via GCC , but when I compile it in NetBeans via Cygwin or MinGW , it doesn't work and keeps throwing a segmentation fault.

View 14 Replies View Related

C++ :: Works On Solaris But Not On Linux?

Apr 24, 2013

I have this following piece of code:

int id = 5;
const char *ptrId;
ptrId = ( int_to_str(id) ).getPtr(); // Works in Solaris well

But the above code prints some junk values when I run the same on Linux machine. But the following works well on Linux:

String temp = int_to_str(id);
ptrId = temp.getPtr();

The prototype of getPtr() is:
const char* String::getPtr() const

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved