• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to create session with other PC  RSS feed

 
Amit Bathla
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I want to know how to create session with other machine using java..

i mean suppose i want to login to remote machine using username and password to access the shared file.. how to do that..??

eg: same as what i do when i give IP address in run tab and then username and password..

please help

Amit
 
Nicholas Jordan
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The sane way to create a session with another machine is to either write the server ( on one of the machines ) in Java java.net.ServerSocket or use a ready written server such as JGroups or the sample server in the supplied sample docs
which becomes very involved and can be the last time you get anything done, unless getting something done involves learning a few things on a dedicated learning machine.

What are you running when you: eg: same as what i do when i give IP address in run tab and then username and password..

This can get very involved:


That was just something I coded for a discussion of how to come up with a port number, you probably are better off using OO's approach and taking something from mayby Sun sample code or something. I had two different randomizers and the calling convention is different so if you care to get this tested as always selecting a port number conformant to PORT NUMBERS and will not stray from the Dynamic and/or Private Ports are those from 49152 through 65535, then you may be up to writing a simple test case that runs both the server and the client in the same process on a development machine.

For anything that runs across two machines I would reccoment staying within OO practice until you are totally certain you can implement Critical Infrastructure Protection using IPv6

IPv4 is notorious for problematic issues that go beyond the code it's self.



[ Message edited for code formatting ]

[ January 12, 2008: Message edited by: Nicholas Jordan ]
[ January 13, 2008: Message edited by: Nicholas Jordan ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!