Results 1 to 2 of 2
  1. #1
    bluebarca is offline Member
    Join Date
    Nov 2007
    Posts
    5
    Rep Power
    0

    Default socket Multithreading - & - Obtaining the IP of a client!

    hey everybody, hope u r all having a gr8 time!
    i have 2 questions:
    1st i have a socket lets a call it x that runs on a pc that acts as a server, when multiple clients try to connect and send data to this socket will there be a problem ( will the java code multithread automatically and manage) or should i implement my multithreading.

    2nd when one of the users sends an input stream to the server ... is there a method so as i can obtain the IP address of this user ?


    i would really appreciate your help guys !

  2. #2
    JavaBean's Avatar
    JavaBean is offline Moderator
    Join Date
    May 2007
    Posts
    1,270
    Rep Power
    10

    Default

    1. Check this tutorial. It is very clear and has simple examples. For handling multiple clients you will need to modify single client code a little bit. The basic idea is handling each connected client with a separate thread but you define what you will do in that thread..

    2. Yes you can obtain IP/hostname. Check javadoc of ServerSocket class. Details are there.

Similar Threads

  1. Server socket - send image to client
    By Hinty in forum Networking
    Replies: 2
    Last Post: 03-14-2009, 07:39 AM
  2. HashMap: Obtaining all values in a collision?
    By markus-sukram in forum New To Java
    Replies: 2
    Last Post: 03-29-2008, 10:25 PM
  3. Identify Client in Socket Client Server Application
    By masadjie in forum Networking
    Replies: 1
    Last Post: 12-20-2007, 09:18 AM

Posting Permissions

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