Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

How to Compare Sockets to Pipes?

1347


How to Examin the Generic Socket Address?

1384


How to Deal with Duplicated Sockets?

1510


What are the best linux system programming interview questions you've ever asked or been asked?

780


Can a socket have multiple connections?

817


How to Close Sockets?

1448


What is the use of PF_INET and SOCK_STREAM?

1316


What is Internet Address Classes?

1372


How to use the PF_LOCAL and AF_LOCAL Macros?

1535


How to Manipulate IP Numbers?

1321


What are sockets used for?

800


What is the use of setprotoent(3) Function?

1564


How to test socket connection in linux?

962


How to look up a Service by Port and Protocol?

1509


What is the use of inet_addr() Function?

1427