Please note that the follow assignement:
Code:
server_addr.sin_addr.s_addr = INADDR_ANY;
...will allow your system to listen in on any interface, but will egress traffic out with the lowest numbered interface.
But if you need to explicitely assign your IP address, then you will have to create another sin.addr construct and give it the IP in network byte order then:
Code:
destination.sin_addr.s_addr = inet_addr("10.10.10.100");
Then call your sendto to use the struct with the above declaration. Please note that the sendto does have an extra struct argument that allows for this.
Code:
/* Added sockaddr *myDestination here as an example */
sendto(int fd,const void *msg, int len, unsigned int flags, const struct sockaddr *myDestination, int tolen);