in reply to Re: Re: more zero byte madness
in thread more zero byte madness

Perhaps there is a buffering issue here? What you're describing isn't quite consistent with that, so if that's the case, something isn't quite as you say it is.

If you want to be doubly certain it's not your client and it's not your network, use something like ngrep to verify the contents of the message. Verify that the entire command is in the message and that it is terminated with a null byte. I cannot imagine that this is not the case.

On the server side, be sure you aren't doing something like while (<$client>) { ... } (without setting $/). Since you're dealing with a binary protocol, it's better in my experience that you use something like sysread to read data, and subsequently chop that data up into discrete commands. You may also have success setting $/ to "\0" and try reading "lines" like above.

If this is a buffering issue, though, I don't know why the server would see \0 but would not see the contents of the command. That just doesn't make any sense to me. With the information you've given us, I don't see how that is possible. Something isn't right.

Replies are listed 'Best First'.
Re: Re: Re: Re: more zero byte madness
by chorg (Monk) on Dec 05, 2000 at 23:15 UTC
    Sorry, perhaps I have not been clear enough. My server gets the data just fine. It is null terminated ASCII, that it gets. The server processes it just fine. When I go to print to the socket, I do this:

    local $\ ="\0"; print $sock $xml;
    and I hope to get that to the application. The application is not getting it however. It seems to recognize that something did arrive, but it seems to think that it's null.

    The client application is Flash 5 by the way, if I did not mention that before. It claims to be able to establish a tcp/ip socket connection to a server (which it can) and then get xml from the result (which is the problem). Any tips at all?
    _______________________________________________
    "Intelligence is a tool used achieve goals, however goals are not always chosen wisely..."

      So when you telnet into the server, it seems to work and actually returns the data followed by the null? Have you looked to see if it is preceding the data with a null? If you have seen that the perl server is working, what is your perl question? I don't think people here can figure out what is wrong with Flash...

      In any case, quick mucking about with the special variables and print the null explicitly. That way you know no extra chars are being sent... print $sock $xml."\00"; # or chr(0) works.

      --
      $you = new YOU;
      honk() if $you->love(perl)