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 TCP/IP Handles Sequencing?

1456


How to Examin the Generic Socket Address?

1340


What is the use of PF_INET or AF_INET?

1521


What is socket connection?

796


What is the use of endservent(3) Function?

1523


What is the use of PF_INET and SOCK_STREAM?

1264


What is the Use of the inet_makeaddr() Function?

1289


What is AF_UNSPEC Address?

2209


Are sockets full duplex?

751


How to Reply to a Wild Address?

1560


How to Test with No Server?

1424


How to Form Internet (IPv4) Socket Addresses?

1427


What is a socket in linux?

875


What is socket and how it works?

838


How to Form Local Addresses?

1360