Sawdusty
04-01-2002, 01:59 PM
Hello,
I've discovered in my networking class that I have to do some client/server programming in java. I was wondering if and how the best way I could run the client and server on the same (linux, of course) compter. Is it possible to create both using localhost as the hostname, somehow?
I haven't even tried this, but I want something that would work like this... would it work?:
Socket clientSocket = new Socket("localhost", 6789);
and in the server:
ServerSocket welcomeSocket = new ServerSocket(6789);
Can I do stuff like that? Even in UDP?
Thanks lots,
Dusty
I've discovered in my networking class that I have to do some client/server programming in java. I was wondering if and how the best way I could run the client and server on the same (linux, of course) compter. Is it possible to create both using localhost as the hostname, somehow?
I haven't even tried this, but I want something that would work like this... would it work?:
Socket clientSocket = new Socket("localhost", 6789);
and in the server:
ServerSocket welcomeSocket = new ServerSocket(6789);
Can I do stuff like that? Even in UDP?
Thanks lots,
Dusty