Server listening on 2 differents ports

Discussion in 'C Programming' started by ssantamariagarcia@hotmail.com, Jul 5, 2005.

  1. Guest

    I am trying to program a server in C for UNIX to get a kind of "bridge"
    between the clients of a port A and the clients of a port B.
    For that, I create 2 processes: one that listen the requests of port A
    clients and another for the Port B ones.

    In each process, when a connetion service is required, after accepting
    , the value of the socket generated is added to a set of sockets. This
    set keeps on listening on each socket for new messages to be read.

    the question is that both processes get the same socket values, I
    mean, the first client asking on port A get the same socket number that
    the first one on port B. So I can not refer to a client in a unique way
    , because there will be 2 clients with the same socket number .

    I am using fork(), and in each process created, I use a method in
    charge of creating the set of sockets and waiting for some event. I
    suspect that the use of fork() is not right in this situation.........


    In other words: If there is anybody who could know how to program a
    server which is going to receive messages on 2 diferents ports and it
    has to carry them from one port to another ( both ways), please, please
    help me.


    Thanks a lot !


    (Sorry about my english)
     
    , Jul 5, 2005
    #1
    1. Advertising

  2. Guest

    I' ll try there. Thanks a lot

    Sonia
     
    , Jul 5, 2005
    #2
    1. Advertising

  3. On Tue, 05 Jul 2005 04:16:27 -0700, ssantamariagarcia wrote:

    > I am trying to program a server in C for UNIX to get a kind of "bridge"
    > between the clients of a port A and the clients of a port B.
    > For that, I create 2 processes: one that listen the requests of port A
    > clients and another for the Port B ones.
    >
    > In each process, when a connetion service is required, after accepting
    > , the value of the socket generated is added to a set of sockets. This
    > set keeps on listening on each socket for new messages to be read.


    Your question is about Unix and socket programming which are not covered
    by the C language itself. A good newsgroup to ask your question is
    comp.unix.programmer.

    Lawrence
     
    Lawrence Kirby, Jul 5, 2005
    #3
  4. CBFalconer Guest

    wrote:
    >
    > I am trying to program a server in C for UNIX to get a kind of
    > "bridge" between the clients of a port A and the clients of a
    > port B. For that, I create 2 processes: one that listen the
    > requests of port A clients and another for the Port B ones.
    >

    .... snip ...
    >
    > (Sorry about my english)


    Your English is satisfactory, your choice of newsgroups is not.
    The C language knows nothing about ports, processes, clients,
    forks, etc. You want a newsgroup that deals with those things.
    Something with one of posix, linux, unix in its name seems
    suitable.

    Before posting there stop and read several days, or a weeks, worth
    of postings. This should give you a strong feeling for whether or
    not your query is topical. Read any welcome or FAQs associated
    with the group.

    --
    "If you want to post a followup via groups.google.com, don't use
    the broken "Reply" link at the bottom of the article. Click on
    "show options" at the top of the article, then click on the
    "Reply" at the bottom of the article headers." - Keith Thompson
     
    CBFalconer, Jul 5, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. aa
    Replies:
    1
    Views:
    311
    Curt_C [MVP]
    Jul 12, 2004
  2. Ricardo Garcia

    about differents encodings

    Ricardo Garcia, Oct 5, 2004, in forum: XML
    Replies:
    2
    Views:
    389
    Martin Honnen
    Oct 5, 2004
  3. john
    Replies:
    3
    Views:
    384
    john fra
    Aug 10, 2006
  4. mreister
    Replies:
    1
    Views:
    3,386
    mreister
    May 25, 2010
  5. Lloyd Zusman

    WEBrick listening on multiple ports?

    Lloyd Zusman, Nov 7, 2004, in forum: Ruby
    Replies:
    4
    Views:
    434
    Stefan Arentz
    Nov 7, 2004
Loading...

Share This Page