2 Attachment(s)
question about sockets in c
Hello,
I am new to socket programming and have bought the book "TCP/IP Sockets in C".
I don't quite understand the relation between the client socket, the server socket and the socket returned by a call to accept().
I have posted two pictures.
In the second picture(client output) I have executed the client
by sending the message "Hello Server" to the server address 172.18.99.185-5001. After connection to the server I output the client address and the server address (using getsockname and getpeername()). So far I understand what's going on.
In the first picture I have executed the server. clntSock is the socket which is returned by a call to accept(). I dont understand
why the peer of clntSock has the address 172.18.99.177-2843.
I expected it to be 192.168.75.130-57994.
Thanks for your help!