ServerSocket and ClientSocket - bi-directional

Discussion in 'Java' started by Abraham Khalil, Jan 26, 2004.

  1. A client can connect to a server socket and send message packets to
    it.
    Can the server socket respond back to the same client socket port, so
    it's bi directional?

    If so, an example logic would be appreciated

    Thanks
    Abraham Khalil, Jan 26, 2004
    #1
    1. Advertising

  2. Abraham Khalil wrote:
    > A client can connect to a server socket and send message packets to
    > it.
    > Can the server socket respond back to the same client socket port, so
    > it's bi directional?


    Yes. Socket connections are bi-directional.

    > If so, an example logic would be appreciated


    Server
    Create ServerSocket
    Wait for connection
    When connected
    Open Output and InputStreams
    Read and write data
    When done
    Close streams
    Close socket

    Client
    Create socket
    Connect to server
    When connected
    Open Output and InputStreams
    Read and write data
    When done
    Close streams
    Close socket

    --

    Knute Johnson
    email s/nospam/knute/
    Molon labe...
    Knute Johnson, Jan 26, 2004
    #2
    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. Daragoth
    Replies:
    4
    Views:
    601
    Just an Illusion
    Jun 30, 2004
  2. JPractitioner
    Replies:
    3
    Views:
    367
    JPractitioner
    Feb 16, 2006
  3. borntonetwork

    PyQt, designer, and directional flow

    borntonetwork, Dec 6, 2006, in forum: Python
    Replies:
    3
    Views:
    482
    borntonetwork
    Dec 7, 2006
  4. Heineken
    Replies:
    1
    Views:
    618
    Victor Bazarov
    Aug 2, 2007
  5. cod3nam3

    serversocket and proxy

    cod3nam3, May 27, 2008, in forum: Java
    Replies:
    4
    Views:
    439
    Silvio Bierman
    May 28, 2008
Loading...

Share This Page