Re: Client Server socket behavior on XP different for 127.0.0.1

From: Tim (nospam4274_at_aol.com)
Date: 09/02/04


Date: 1 Sep 2004 20:14:48 -0700

Steve Horsley <shoot@the.moon> wrote in message news:<ch5g6l$p2q$1@news.freedom2surf.net>...
> Any data sensitivity is due entirely to your code - not the TCP stack.
>
> Firstly, you are probably using different character set conversions
> between the sender and the receiver, because DataOutputStream.writeBytes()
> just takes the lower 8 bits of the character (effectively using ISO8859-1
> encoding), but new InputStreamReader(InputStream) creats a Reader that uses
> the platform default characterset encoding. So you cannot at the moment
> be sure that the characters you send are the characters you receive.
> It may be that your (char)14 is being converted to a questionmark.
>
> Secondly, beware that TCP does not respect message boundaries - it can
> split or concatenate chunks of data that are sent in separate write()
> calls. This splitting and concatenating is affected by network
> timing, so may behave differently locally to the same machine than
> over a network. If you assume that a read() will always get exactly
> what one write() sent, you will eventually go wrong.
> You seem to be using explicit message boundaries here
> (using '\n', '\r' or "\r\n" as the separator), but bear this
> in mind for the future.
>
> Thirdly, if you use a buffered writer, remember to call flush() at
> the end.
>
> I don't know why you would get an exception - there is nothing in
> the code you posted that ever closes the connection.
>
> I don't know why using the loopback address should change behaviour.
>
> Steve

Thanks for the response, here is a little more info and more questions
:)

The error message/traceback from the server log file is as follows:
ERROR::Mon Aug 30 10:33:53 2004::thread=Thread-6::SendThread.run():0
to null::java.net.SocketException: Software caused connection abort:
socket write error
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at java.net.SocketOutputStream.write(SocketOutputStream.java:105)
at java.io.DataOutputStream.writeBytes(DataOutputStream.java:256)
at SendThread.run(SendThread.java:24)
at java.lang.Thread.run(Thread.java:536)

Is it possible that (char)14 would really come through as something
other than 14 when treated as a number? How could using 127.0.0.1 vs
real IP affect the char set used? Any advice on how to specify char
set in both client and server to correct this issue?

I do not think network latency is a factor, as the linux machines the
server has run on have been in Texas and California with clients
connecting from as far away as Lithuania. This issue only happens on
XP. The server gets the same exception it would get for a client
machine being unplugged from the network. And the client gets the
same error it would get if the server machine just went away. The
really odd part is that some of the messages get through. Users can
login, or create a new account, but once the password has been
entered/verified, the client gets no more messages. This points to
something in the code, but I am having trouble seeing what it is.

The complete source for client and server is available here:
http://prdownloads.sourceforge.net/duskrpg/sourceFiles.zip?download

Are you saying that
stmOut.writeBytes(""+(char)3+"client message\n");
could get split up into multiple writes? How would stmIn.readLine()
react to that? I am assuming it waits for the \n.

Thanks again for the help!
Tim



Relevant Pages

  • RE: Printing from Win9x clients stops
    ... Open Server Management. ... then right-click the name of the computer running Windows Small Business ... >From the client computer: ... The Select Network Component Type ...
    (microsoft.public.windows.server.sbs)
  • RE: Printing from Win9x clients stops
    ... The printers with 9x drivers on the server appeared automatically in the ... > then right-click the name of the computer running Windows Small Business ... > From the client computer: ... The Select Network Component Type ...
    (microsoft.public.windows.server.sbs)
  • Re: Daily Server Report (Critical Errors, Event ID: 537)
    ... Does this issue happen on client workstation or server? ... Does your server and all clients' workstation work well now? ... issue in your Network? ...
    (microsoft.public.windows.server.sbs)
  • Re: Small business thinking about backing up data, having a server and 2-3 users - is SBS200
    ... is networked to the Master with a crossover network cable. ... Master on the Master PC and Client on the Slave pc. ... Since this machine is a server is should handle the requests ok ... Most real firewall appliances have HTTP and SMTP proxy services that allow ...
    (microsoft.public.windows.server.sbs)
  • RE: Private addresses on public network
    ... anybody accesses those computers from an external network," -- even when the ... JavaScript delivered to the client that causes the client to retrieve ... the attacker, the request results in another JavaScript response that tells ... Moving beyond a single server ...
    (Security-Basics)