c# - My application (sever/client) is blocked after using Readline -


im trying make tcp connection between server , client . server programmed on c# , cliend on java... server working fine... problem in code:

try {   inetaddress address = inetaddress.getbyname("127.0.0.1");   connection = new socket(address, port);           bufferedreader infromserver = new bufferedreader(          new inputstreamreader(connection.getinputstream()));   logininfo = infromserver.readline();   system.out.println("username/pass  received");   system.out.println(logininfo);   connection.close(); } catch (ioexception f) {   system.out.println("ioexception: " + f); } catch (exception g) {   system.out.println("exception: " + g); } 

the application blocked , can't close more... until finish debug java . guess problem in logininfo because im not getting username/pass received in output .. help?

this thread send message c# :

thread listener_service = new thread((threadstart)delegate {   listener.start();   while (true)   {     s = listener.acceptsocket();     console.writeline("connected !" + s.remoteendpoint);     asciiencoding asen = new asciiencoding();     s.send(asen.getbytes("the string recieved server. \n"));     console.writeline("\nsent acknowledgement");     continue;   } }); 

calling readline() blocking call, means code execution blocked until , unless receive line server communication.

use system.environment.newline instead of \n terminate line in c# code.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -