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 Test with No Server?

1521


What is the difference between socket & port?

957


What are Nameless Sockets?

1614


How to Form Abstract Local Addresses?

1427


What is the use of PF_INET and SOCK_STREAM?

1365


What is socket file in linux?

1014


How to Manipulate IP Numbers?

1378


What is socket abstraction?

887


What are Private IP Numbers?

1272


What is socket linux?

875


How to Initialize a Wild Internet Address?

1718


What is socket and how it works?

940


What is the Use of the inet_ntoa() Function?

1325


What are Anonymous Calls?

1395


What are the different types of sockets?

951