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 perform I/O on Sockets?

1445


What are Anonymous Calls?

1358


How to Form Internet (IPv4) Socket Addresses?

1506


How to open socket file in linux?

1030


How TCP/IP Handles Sequencing?

1519


What is socket and how it works?

891


Are sockets full duplex?

817


What is the use of SOCK_DGRAM Socket Type?

1406


How to Manipulate IP Numbers?

1343


How to Choose a Socket Type?

1304


How does socket communication work?

890


What is the use of PF_INET and SOCK_STREAM?

1328


How TCP/IP Handles Lost Packets?

1637


How TCP/IP Handles Flow Control?

1597


What is the use of endprotoent(3) Function

1697