Switch

Hi,

I have a client/server program.

On the client side I have set up ActionListener initiated buttons to send a letter and the data in a field to the client (on the client side it looks like this - EName).

On the server side I have a number of methods that look similar to this:

switch(clientLine.charAt(0))

{

case'E':

{

String staffName = (String)emails.get(clientLine);

pw.println(staffName);

break;

}

The intention is to retrieve the name of a staff member from a server side hashtable called emails and send it back to the client.

Any help or suggestion on the correct syntax for this method would be very much appreciated.

[886 byte] By [nick211001a] at [2007-11-27 7:36:13]
# 1

Did you see the echo server example in the java tutorial? That demonstrates communication between a client and a server.

http://java.sun.com/docs/books/tutorial/networking/sockets/index.html

I don't get exactly what you do not know how to do. You can already send data from the client to the server, why are you struggling to send something back? It is basically the same.

gimbal2a at 2007-7-12 19:16:43 > top of Java-index,Java Essentials,New To Java...