Hi
if you are using TCP sockets you must have a structure of type sockaddr_in. In field sin_port you may indicate the destination port. Refer to the snippet below.
#define DESTPORT 1030
sockaddr_in addr;
addr.sin_family = AF_INET;
addr.sin_port = 0;
addr.sin_addr.s_addr = INADDR_ANY;
error = bind(sock, &addr, sizeof(addr));
addr.sin_port = DESTPORT;
addr.sin_addr.s_addr = IPADDR(192,168,1,132); //Server address
error = connect(sock, &addr, sizeof(addr));
Regards,
Carlos