I am learning Java and I have just got myself confused.
I am trying to create something which would act like a proxy server(I want to demonstrate how a pda would work while on the move) :
The first thing my server does is make an connection with the client;
Then it opens a socket to it,
It will receive text from the client (string), and send the string to another server, this other server will then send another string back to server, then the server will return it to the client.
Here is all that I have so far:
import java.net.*; import java.io.*;
public class PDAServer { public static void main (String args[]) { int port = 1027; ServerSocket myServerSocket = null;
try { myServerSocket = new ServerSocket (1027); } catch (IOException e) { System.out.println("Exception when creating ServerSocket: "+e); System.exit(1); } System.out.println("...started.");
if ( pda_String.trim().equals("bye")){ System.out.println("Closing connection to client"); MySocket.close(); }
} }
I am just baffled by this, If you can send me any tips or links to tutorials pages with an example similar (although I think I may have looked at them all - but I would appreciate anything).
I have looked at a lot of client/server examples but I am just confused at the next stage of receiving a string and sending on to another server.