Results 1 to 2 of 2
- 11-16-2007, 01:01 AM #1Member
- Join Date
- Nov 2007
- Rep Power
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 !
- 11-16-2007, 10:09 AM #2
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.
- By Hinty in forum NetworkingReplies: 2Last Post: 03-14-2009, 07:39 AM
- By markus-sukram in forum New To JavaReplies: 2Last Post: 03-29-2008, 10:25 PM
- By masadjie in forum NetworkingReplies: 1Last Post: 12-20-2007, 09:18 AM