Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
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 12-30-2007, 06:17 PM
tim's Avatar
tim tim is offline
Senior Member
 
Join Date: Dec 2007
Location: South Africa
Posts: 334
tim is on a distinguished road
Java networking.
Hello everyone.

I have a book called "Sams teach yourself java in 21 days" that I am currently using. In chapter 17, "Cummunicating Across the Internet", there are examples for creating servers using the ServerSocket class in the java.net package. I would like to know if it possible to create a simple connection between two computers connected via TCP-IP LAN, and not via the Internet. It would help if someone could give me an example of a server/client program using these classes or direct me to a suitable website or article.

Thank you.
__________________
If your ship has not come in yet then build a lighthouse.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 12-31-2007, 01:34 AM
CaptainMorgan's Avatar
Moderator
 
Join Date: Dec 2007
Location: NewEngland, US
Posts: 841
CaptainMorgan will become famous soon enoughCaptainMorgan will become famous soon enough
Send a message via AIM to CaptainMorgan
It will be interesting to see a definitive answer on this. But I would just like to make a clarification here... whether the program goes over a LAN or through the Internet, you're still going with the program model of client/server, correct? So for the most part, it doesn't really matter which connection you use. I say this because in order to reach say Google, you'd use the IP of Google, but if you only wanted to connect to your LAN's server you'd use that local IP(192.168.0.xxx). I look forward to seeing a concrete example too, but I don't think it is much different from the previous connection via the Internet... conceptually. And technically speaking, this works the same for SSH. All that matters is whether your client machine is physically on the LAN or not, if it's not then it will not find the local IP, if it is - it will.

Last edited by CaptainMorgan : 12-31-2007 at 01:36 AM.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 12-31-2007, 07:00 PM
tim's Avatar
tim tim is offline
Senior Member
 
Join Date: Dec 2007
Location: South Africa
Posts: 334
tim is on a distinguished road
Thanks
Thank you CaptainMorgan. I'll try another Google search for an example.
__________________
If your ship has not come in yet then build a lighthouse.
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 01-02-2008, 04:22 PM
Member
 
Join Date: Nov 2007
Posts: 2
kinzo is on a distinguished road
hahahaha, are u sure
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 01-02-2008, 07:58 PM
CaptainMorgan's Avatar
Moderator
 
Join Date: Dec 2007
Location: NewEngland, US
Posts: 841
CaptainMorgan will become famous soon enoughCaptainMorgan will become famous soon enough
Send a message via AIM to CaptainMorgan
Quote:
Originally Posted by kinzo View Post
hahahaha, are u sure
Hi kinzo, please quote whom you're replying to... are you replying to me? or Tim? Thanks!
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 01-05-2008, 08:25 PM
tim's Avatar
tim tim is offline
Senior Member
 
Join Date: Dec 2007
Location: South Africa
Posts: 334
tim is on a distinguished road
Success
Hello everyone.

I have successfully created a network application that can act as a server or client for a network connection between two computers. The application is designed for instant messaging. I have tested the application at home and it works well. I would like to know, however, if my program will be able to work over the internet as well. I know CaptainMorgan said:
Quote:
So for the most part, it doesn't really matter which connection you use.
but, I cannot test that for myself.

Thanks everyone for the help so far.
__________________
If your ship has not come in yet then build a lighthouse.
Bookmark Post in Technorati
Reply With Quote
  #7 (permalink)  
Old 01-05-2008, 08:31 PM
CaptainMorgan's Avatar
Moderator
 
Join Date: Dec 2007
Location: NewEngland, US
Posts: 841
CaptainMorgan will become famous soon enoughCaptainMorgan will become famous soon enough
Send a message via AIM to CaptainMorgan
If you tested it at home then it should work given the new IP address you list for the client of the server is a valid one. I assume for the home test you used, 127.0.0.1? Provided firewalls and the like, and port is available, it might be as simple as changing the localhost address to the new one.

I realized the above paragraph might be a slight repetition of my previous post Tim. This morning I just finished building a client/server app of my own which represents a chat room, likely similar to your IM'ng app. I'm pretty sure the IP address change I mention solves it - I know this because I tested mine via my local machine via 127... and I also uploaded it to my remote server and it was a success.

Let us know what you come up with
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
to our beloved Java Forums!
(closes on September 4, 2008)
Want to voice your opinion on your IDE/Editor of choice?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
!
Got a little Capt'n in you? (drink responsibly)

Last edited by CaptainMorgan : 01-05-2008 at 08:41 PM.
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
Java networking programming (II) Java Tutorial Java Tutorials 0 12-27-2007 08:19 PM
Java networking programming (I) Java Tutorial Java Tutorials 0 12-24-2007 09:21 PM
Multithreading + Networking (desperate) bluebarca New To Java 1 11-07-2007 04:14 PM


All times are GMT +3. The time now is 01:31 PM.


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