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



Scott,
It should always be a one to one relationship between the send and recv. My
application sends one command and will recv one respond back from the
server. Yes, in theory, I could send all three commands and then recv all
three responds back at once. But this senario will not happen in this
application.

The server is actually not a true socket server application. It is actually
a modem (v.35) type application. The network guy puts a CISCO route, that
speak TCP/IP, in between my socket app and the actual modem server. So, my
app actually speck to this CISCO route and it then sends the data to the
target server. Sometime if the CISCO route is not configured correctly,
I'll see the respond being echo back to me (seeing the same respond twice).
So, I'm kind of worry that this echoing problem might throw my app to become
out of sync on this one to one send and recv relationship.

Albert,
I've never had a chance to use select() api. So, I'll have to look more
into this. I was thinking recv() in non-blocking mode will flush this
echoing problem and hence keeps my send() and recv() in sync.

Thanks

"Albert York" <alfromme@xxxxxxxxx> wrote in message
news:mailman.25913.1296172727.2702.midrange-l@xxxxxxxxxxxx...
I think what he is saying is that he wants to make sure the receive
buffer is empty before he sends anything.

If that is the case then select() should work.

Albert

On Thu, Jan 27, 2011 at 3:18 PM, Scott Klement
<midrange-l@xxxxxxxxxxxxxxxx> wrote:
Hello,

I'm not sure that I understand? Let's see if I do...

You are sending multiple requests:

req = 'COMMAND TO DO SOMETHING';
send(fd, req, len(req));
req = 'COMMAND TO DO SOMETHING';
send(fd, req, len(req));
req = 'COMMAND TO DO SOMETHING';
send(fd, req, len(req));

In this example, 3 requests. Now you want to get the response from the
3 requests, but you want to make sure you get the response from the last
one?

If so, why not use a counter? (Keep receiving until you've received the
3rd response.)

I don't understand what this has to do with blocking/non-blocking?



On 1/27/2011 3:24 PM, hockchai Lim wrote:
I've a socket client application that calls the send() api to send some
request data to the sever and then calls the recv() api to receive the
result from it. A fairly typical socket client program. But because this
is a critical application, I would like to have a way to ensure that all
the
result data that I'm getting from the recv() api calls are for the last
very
last send() request that I've just sent out. So, I'm thinking, I should
call the recv() api in non-blocking mode before I call the send() api to
flush out all the recv() buffer. Would this be a wise idea?

thanks





--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.





As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.