Shpongle
November 1st, 2010, 08:54 PM
Hi all , basically Im developing my final year project for college that consists of a python server an oracle db backend and an android client.
I have started with the server and coded a small python client to test it and for now it works as expected. Now I have started on the actual client and I want to receive a string upon confirmation on the client that it is connected to the server.
it works fine going python to python , using
conn.send('Connected to server')
where conn refers to the connection .
i.e. conn,addr =s.accept() #establish a connection with the client
on the python test client I receive this message as soon as the connection is accepted by the server using print s.recv(1024). With the java one however I get nothing and the program just waits
snippet of the java code
host = InetAddress.getByName("127.0.0.1");
link = new Socket(host,port);
in = new BufferedReader(new InputStreamReader(link.getInputStream()));
//display connection confirmation
String message = in.readLine();
System.out.println (message);
If I can get it in java it will work in android as they use the same socket primitives.
any ideas ? , thanks
I have started with the server and coded a small python client to test it and for now it works as expected. Now I have started on the actual client and I want to receive a string upon confirmation on the client that it is connected to the server.
it works fine going python to python , using
conn.send('Connected to server')
where conn refers to the connection .
i.e. conn,addr =s.accept() #establish a connection with the client
on the python test client I receive this message as soon as the connection is accepted by the server using print s.recv(1024). With the java one however I get nothing and the program just waits
snippet of the java code
host = InetAddress.getByName("127.0.0.1");
link = new Socket(host,port);
in = new BufferedReader(new InputStreamReader(link.getInputStream()));
//display connection confirmation
String message = in.readLine();
System.out.println (message);
If I can get it in java it will work in android as they use the same socket primitives.
any ideas ? , thanks