Thread: Socket Identifier?

  1. #1
    Registered User
    Join Date
    Sep 2011
    Location
    India
    Posts
    27

    Socket Identifier?

    Hello Experts,

    My Doubts:

    1) I have heard that Socket is an endpoint residing on the host. If so then how a socket is uniquely identified?

    2) Can this endpint communicate with multiple sockets on remote hosts?

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    1) by it's handle
    2) yes.

  3. #3
    Registered User
    Join Date
    Dec 2011
    Posts
    795
    Quote Originally Posted by sumit180288 View Post
    1) I have heard that Socket is an endpoint residing on the host. If so then how a socket is uniquely identified?
    Most sockets are represented by an int, which is then passed to functions that connect/send/receive/perform other operations on it. The actual socket itself is a structure, but the user never sees that part.

    Quote Originally Posted by sumit180288 View Post
    2) Can this endpint communicate with multiple sockets on remote hosts?
    That depends on the type of socket, but usually yes.

  4. #4
    Registered User
    Join Date
    Sep 2011
    Location
    India
    Posts
    27
    There are two types of scokets:

    1) TCP socket: multiple sockets can be bound to a single port in this case. These are the ESTABLISHED or Active Sockets , the ones which are Exchanging the data. The Other Type of TCP socket is a passive socket which listens to incoming connections and only one PASSIVE Socket can be bound to a port. (on the contrary multiple ACTIVE sockets can be bound to a same port)

    2) UDP Socket: It is a socket which will itself handle all the data by itself serially, destined to itself (on the contrary TCP socket will spawn a new ACTIVE socket to handle the new incoming Clients.

    Quote Originally Posted by sumit180288 View Post
    Hello Experts,

    My Doubts:

    1) I have heard that Socket is an endpoint residing on the host. If so then how a socket is uniquely identified?

    2) Can this endpint communicate with multiple sockets on remote hosts?

  5. #5
    Registered User
    Join Date
    Dec 2011
    Posts
    795
    Not sure why you're telling us, you're the one asking the questions.

    Either way, there's many different types of protocols (TCP/UDP being some of them), but three different types of sockets. Raw (packet) sockets that send data as it is gotten from the user, datagram sockets that encapsulate the data in datagrams ( UDP uses this ), and connected sockets which rely on a handshake system (TCP).

  6. #6
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by memcpy View Post
    Not sure why you're telling us, you're the one asking the questions.
    Do you think we passed the test?

  7. #7
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    Probably right - the OP is nothing but a serial quiz question robot.
    Search Results - C Board

    Post code, or leave town.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. expected identifier
    By ozu in forum C Programming
    Replies: 5
    Last Post: 08-21-2010, 06:32 PM
  2. c identifier error
    By walataza in forum C Programming
    Replies: 11
    Last Post: 03-03-2008, 03:51 AM
  3. help with identifier
    By jbook in forum C++ Programming
    Replies: 2
    Last Post: 10-01-2007, 12:18 AM
  4. n00b doing a Socket operation on non-socket
    By Kinasz in forum Networking/Device Communication
    Replies: 2
    Last Post: 03-25-2004, 03:29 AM
  5. identifier problem
    By gogo in forum C++ Programming
    Replies: 2
    Last Post: 11-27-2001, 12:09 PM