Sending Serialized Objects to A Server And Displaying the contents
hi, i am trying to input a student name on a client(which is working for me) , which is then sent to a server and displayed on the server screen!! i just cant get this to work for me for some reason!
It stops at "s = (Student)istream.readObject();" on the server, could someone please help me on this one as i've pulled out nearly all my hair at this stage! ;-)
i have added the functions (minus some catch expressions) below, the server and sockets etc are all working fine! cheers.
Any tips, help would be very much appreciated!
<Server code>
private static void run()
{
try
{
link = servSock.accept();
PrintWriter out = new PrintWriter(link.getOutputStream(),true);
ObjectInputStream istream = new ObjectInputStrea(link.getInputStream());
Student s = null;
Try
{
s = (Student)istream.readObject();
System.out.println("Name=" + s.getName());
} catch (Exception e){ }
...............
}
<End of Server Code>
<Client Code>
private static void run() throws ClassNotFoundException
{
try
{
Socket link = new Socket(host,PORT);//Step 1.
BufferedReader in = new BufferedReader(new
InputStreamReader(link.getInputStream()));
ObjectOutputStream out =
new ObjectOutputStream(link.getOutputStream());
BufferedReader userEntry = new
BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter Name");
name = userEntry.readLine();
...................
<end of client code>

