Can there be socket connection without nowing the port, given socket descriptor?

Posted on 2003-03-13
Medium Priority
Last Modified: 2013-12-23
Hi ,
I am new to this socket programming in UNIX.
OK here is my doubt.
I am using a third part CAPI. Th API makes connection to
a server which periodically sends message to my C program.
There is a API call ifGetSocket(int id) which would
give me the socket descriptor. id is an int maintained by
the third part to identify various sessions.
The Help says:
This socket descriptor returned by this API call can
be used in UNIX select call to check any message was sent by the
The connection to the server is established and I can send message to the server
but I dont know which port it used to connect. I know the server name and the
socket descriptor.
My question is:
Is it possible to receive messages with just the server name and socket descriptor?
Question by:shuva
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 51

Accepted Solution

ahoffmann earned 200 total points
ID: 8135762
the handle id is all you need, just feed it to the select() function, if select returns do appropriate work (for example reading from id).
   man select
for details,
   man socket
   man bind
   man listen
   man read
might help also ;-)

Expert Comment

ID: 9157076
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Post your closing recommendations!  No comment means you don't care.

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This program is used to assist in finding and resolving common problems with wireless connections.
This article is in regards to the Cisco QSFP-4SFP10G-CU1M cables, which are designed to uplink/downlink 40GB ports to 10GB SFP ports. I recently experienced this and found very little configuration documentation on how these are supposed to be confi…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question