1 Reply Latest reply: Feb 15, 2011 12:49 PM by tschodt RSS

    Creating a serverSocket while sonnecting to a socket on the same port

    839984
      I want to make a file transfer application for multiple clients, there will not be a server that users will connect to, the application serves as client AND server, every client will have a serversocket object listen for new connections (it will recieve a connection when someone wants to send a file to them) and I will also have a socket object that will connect to a client when I want to send a file to them.

      Is it possible to run all these connections on a single port? Or will there be a conflict?
        • 1. Re: Creating a serverSocket while sonnecting to a socket on the same port
          tschodt
          836981 wrote:
          I want to make a file transfer application for multiple clients, there will not be a server that users will connect to, the application serves as client AND server, every client will have a serversocket object listen for new connections (it will receive a connection when someone wants to send a file to them)
          Read up on peer-to-peer.
          and I will also have a socket object that will connect to a client when I want to send a file to them.
          A new socket for each outbound connection.
          Is it possible to run all these connections on a single port?
          Yes. A serversocket listens for connections to a specific port number, it can accept many connections.
          Or will there be a conflict?
          No. Your outbound connections will not use the same port number locally.

          You are more likely to encounter problems with clients (peers) behind NAT routers.