× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Gerald,

On Mon, 26 Jan 2004 GKern@xxxxxxxxxxxxxxxx wrote:
>  * Send the segment to the server over the socket...
>  * (NOTE - Need to add 2 to SockDtaLen since SocketData is defined as
>  *  VARYING - which adds 2 extra bytes to the field since the first
>  *  two bytes contain a binary value that identifies the actual length
>  *  of the data in the variable length field...)
> C                   Eval      RC = Write(SD:%Addr(SocketData):SockDtaLen+2)

I don't know if this is intentional, but your code is sending not only the
data in the "SocketData" string, but also the 2 bytes at the start which
indicate the length of the string.

If the receiving program isn't expecting to receive that 2-byte length, it
may be confused about how to handle this.  If the length happens to be 11,
for example, you'd get two bytes x'00' and x'0b' as the first two bytes of
the data that is sent.

What you probably want to do is code it like this:

> C      Eval      RC = Write(SD:%Addr(SocketData)+2:SockDtaLen)

That way, it will only send the string, not the length that precedes it.

also, unless you're coding blocking sockets (which is a nice place to
start learning, but makes for a less robust application) you'll want to do
this sending in a loop, keep adding the length already sent to the address
and subtracting it from "SockDtaLen".

RC doesn't just tell you if it succeeded or failed, it also tells you how
much of your data got sent.

Hope that helps...

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.