print out client IP which has been connected to the server

Hai

I have successfully write a socket code where data can be sent to/from a client/server host using c++. However, I would like to add a function where the server can print out to the user the ip number of the client which has successfully connected to the server. For example, the client uses 192.168.1.5 and when the client is connected to the server, the server will display to the monitor "192.168.1.5 is already connected to the server". The network environment can be in LAN as well as WAN. How can i do this? thanks.
For a connection-oriented socket see

man getpeername

Topic archived. No new replies allowed.