how to get client port number in server socket programming??
Answer Posted / supraja aldena
After accepting connection.Just type this, u wil get
client ip address and port number.
printf("\n(%s , %d)\n",inet_ntoa(client.sin_addr),ntohs
(client.sin_port));
| Is This Answer Correct ? | 8 Yes | 0 No |
Post New Answer View All Answers
How to Compare Sockets to Pipes?
How to Examin the Generic Socket Address?
How to Deal with Duplicated Sockets?
What are the best linux system programming interview questions you've ever asked or been asked?
Can a socket have multiple connections?
How to Close Sockets?
What is the use of PF_INET and SOCK_STREAM?
What is Internet Address Classes?
How to use the PF_LOCAL and AF_LOCAL Macros?
How to Manipulate IP Numbers?
What are sockets used for?
What is the use of setprotoent(3) Function?
How to test socket connection in linux?
How to look up a Service by Port and Protocol?
What is the use of inet_addr() Function?