I\'m making a server program using TCP and I want to get the IP adress of the sender of the message I just received. Here\'s my code:
case FD_READ:
{ //In
For a connected TCP socket, you should use getpeername() to obtain the address of the remote socket.
TCP is a connection-oriented protocol. from
and fromlen
are meant to be used with connectionless protocols, such as UDP. According to the documentation, recvfrom
ignores from
and fromlen
for connection-oriented sockets.