java - readline() doesn't read from socket -
s = new socket(inetaddress.getbyname(address), port); thread.sleep(250); dataoutputstream outtoserver = new dataoutputstream(s.getoutputstream()); bufferedreader infromserver = new bufferedreader(new inputstreamreader(s.getinputstream())); outtoserver.writebytes("my_query"); string rs = infromserver.readline(); s.close();
nothing happens, if use .read() receive first character of string.
i don't know message lenght i'll receive, in python use: sock.recv(1024) 1024 max lenght can receive.
is there way same thing in java?
according javadoc of readline():
reads line of text. line considered terminated 1 of line feed ('\n'), carriage return ('\r'), or carriage return followed linefeed.
make sure string has correct structure.
Comments
Post a Comment