> I need to establish 2 different UDP session sockets in my client code
> (directed to 2 different servers ) but sharing the same local port in
> both sockets. Is that possible in Windows?
Only if the two sockets are bound to different local IP addresses.
Otherwise, no, you would have to use different ports instead. Or, use a
single UDP socket and have it differentiate between the packets that it
recieves from each server. If nothing else, you can look at the IP/Port
that is sending each packet, if the packet data is too similar to
differentiate with.
--
Remy Lebeau (TeamB)
Yes. Have you tried this, what happens? Since the connection is
uniquely identified by the {local ip addr, local port, remote ip addr,
remote port} it should work since you have 2 different servers. If it
doesn't work you may need to set the SO_REUSEADDR option on the
sockets.
> Yes. Have you tried this, what happens? Since the connection is
> uniquely identified by the {local ip addr, local port, remote ip addr,
> remote port} it should work since you have 2 different servers.
Except that you cannot have two server sockets bound and listening on the
same localip/localport pair at the same time.
> If it doesn't work you may need to set the SO_REUSEADDR
> option on the sockets.
If you use that, both servers can end up receiving each other's data.
--
Remy Lebeau (TeamB)
>>>>Boris>>>>>>>>
This won't work for UDP (if UDP datagrams need to be sent from server to
client).
However, in case of TCP it will work just fine:
2 client TCP sockets are bound to same port and IP address (SO_REUSEADDR
option is used);
2 server tuples are different from each other.
Boris