Results 1 to 2 of 2
  1. #1
    MasterD is offline Member
    Join Date
    Mar 2009
    Location
    Germany
    Posts
    22
    Rep Power
    0

    Default P2P like Chat with central connection server, will work?

    Hi all,

    I'll try to keep this short, but first of a bit of context:

    I've developed a chat program (chatting+buddy list) where a central server hosts the buddy list and informs the active clients of the state of there buddies. The actual chatting is performed peer to peer like, where the first client is the chat server (and will always be, no handover). When a clients wants to chat, it sends a information message through the server to the other client, with information about how to connect to the chat. Then they connect and the users babble till the end of days (without using the main server).

    So, this is working.... with a LAN or clients directly connected to the internet. This is not enough, as the Clients can also be behind a router/firewall/NAT.

    I've thought of solutions involving tcp hole punching (like STUNT) or usage of the UPnP functionality of some routers. This was due to the idea, that I need several dynamically allocated inbound ports with the client. All these are not so ideal, with respect to security of the users network.

    However, it should be possible that there is one defined inbound port (say: 4711), which directs incoming data to the respective chat(s) at a client. So, if I can get this stuff working, there will be one final but important question:
    How to get the public / NAT address of the client?

    Can it be retrieved by the central server, after it accepted a socket with
    Java Code:
    ((InetSocketAddress) socket.getRemoteSocketAddress()).getAddress()
    So, first question: Do you think, a "one inbound port" should work (with not too much additional work on the data forwarding)?
    Second: If the above should work, does the shown code work, to get the public IP of the client?

  2. #2
    MasterD is offline Member
    Join Date
    Mar 2009
    Location
    Germany
    Posts
    22
    Rep Power
    0

    Default

    Well, about the "one port" part, this works :)

    However, can anyone affirm the correctness (or malfunction) of the above shown code, when trying to get the public IP of the client?

Similar Threads

  1. Multithread Chat server/client
    By gwaldarick in forum Advanced Java
    Replies: 3
    Last Post: 09-19-2009, 12:22 AM
  2. Multi-user chat server and client
    By 435.mahesh in forum Java Software
    Replies: 6
    Last Post: 04-25-2009, 12:45 AM
  3. Multi Client/Server Chat Question
    By Kodak07 in forum Networking
    Replies: 3
    Last Post: 03-29-2009, 10:50 PM
  4. simple chat server
    By sari in forum New To Java
    Replies: 0
    Last Post: 02-06-2009, 02:30 AM
  5. Replies: 2
    Last Post: 12-27-2008, 08:02 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •