Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-16-2007, 02:01 AM
Member
 
Join Date: Nov 2007
Posts: 3
bluebarca is on a distinguished road
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 !
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 11-16-2007, 11:09 AM
JavaBean's Avatar
Moderator
 
Join Date: May 2007
Posts: 1,272
JavaBean is on a distinguished road
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.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
HashMap: Obtaining all values in a collision? markus-sukram New To Java 2 03-29-2008 11:25 PM
Identify Client in Socket Client Server Application masadjie Networking 1 12-20-2007 10:18 AM
Why use multithreading? JavaForums Java Blogs 0 12-17-2007 01:21 PM
Server socket - send image to client Hinty Networking 0 11-30-2007 09:15 PM
Socket Programming (Client) JavaForums Java Blogs 0 11-26-2007 05:00 PM


All times are GMT +3. The time now is 10:50 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org