× 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.



Hi Doc,

> 3. PC around and sends an acknowlegement to the 400 that it's received the
> data.  The acknowledgement is an 8-bit binary zero value (x'00', or &H0 for 
> you
> Visual Basic fans).  The send works just fine.
>
> 4. I do the recv() on the AS/400 to receive the acknowledgement as follows:
>   rc = recv( piSocket, %addr( piBuffer ): %len( piBuffer): 0 );
> However, no data is received.  By "no data received", rc is zero.

When you receive an rc of zero from recv(), it's telling you that an error
occurred.  Have you checked the value of errno?


> This makes no sense to me.  As I understand it, the socket I have
> created is a blocking socket.  If this is the case, then why does my
> recv() read data from the line, and then return zero?  I thought if you
> read a blocking socket, the program waited on the recv() until data was
> present, or a timeout ocurred, or an error ocurred.

There are no timeouts.  recv() waits until data is received or an error
occured.  That's why you'll see me say (in several past threads here) that
you should always use non-blocking sockets so that you don't get stuck
waiting forever. :)

But, that's not the problem that you're experiencing...  If you're getting
a zero returned from recv() it means that either an error has occurred, or
that you passed a zero as the size of your buffer...

I assume that %len(piBuffer) doesn't evaluate to zero?


> Have I created a non-blocking socket?  I don't know.  In a separate procedure,
> I created a socket using:
[SNIP]
> Does this create a blocking socket?

Blocking is the default -- unless you set the nonblocking flag using
fcntl() or ioctl() or a similar function, the socket will be blocking.

Hard to say what you're doing wrong.  Nothing that you posted looked
wrong...   Please check the value of errno to see what the error coming
from recv() is, that might help you get on track.



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.