Quote:
|
Originally Posted by randyding
Its done with bind(), it takes a struct sockaddr * where you can set the local interface address (if there is more than 1) and local port number. Binding is normally done immediately after calling socket().
|
Thanks for replying.
What should is use for the sin_addr.s_addr address?
my code does not allow me to send packet thru udp anymore if i add the following:
memset((char *) &si_me, sizeof(si_me), 0);
si_me.sin_family = AF_INET;
si_me.sin_port = htons(PORT);
si_me.sin_addr.s_addr = htonl(INADDR_ANY);
if (bind(s, &si_me, sizeof(si_me))==-1)
printf("bind() failed\n");