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



If your select() statement times out with no data, sock = 0. Are you
cycling through and re-reading the buffer? You should clear the read
buffer after you process the data. Also if sock = 0 on select(), you
have no data so just loop back to select. I check for and external end
and close all the socks then end the program with LR on.

Chris Bipes
Director of Information Services
CrossCheck, Inc.
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of
GKern@xxxxxxxxxxxxxxxx
Sent: Wednesday, October 03, 2007 11:49 AM
To: midrange-l@xxxxxxxxxxxx
Subject: Socket Buffering question

I'm using Scott Klement's socket tutorial as the template for a socket
server that uses non-blocking sockets with select() to support multiple
(3) clients at once.

Right now I have only one client active, but for some reason when I
receive data, I receive the same data string x number of times over a
short period of minutes and in one instance over a period of about 50
minutes.

For example one message was received 23 times (in a row) and the next
one
27 times.
Following that the next five unique messages were received 27, 30, 14,
27
& 26 times (each received x number of times in a row).

The client says they are not responsible for sending the same data
repeatedly.

I'm wondering if the following code inserted into this subroutine in the

template to read & write to the buffers is incorrect and responsible for

this problem.

Is this not the correct location (note code prefixed with gpk) to be
reading the input buffers and writing the output buffers?

sk CSR CheckSockets begsr
sk C*------------------------
sk c do MAXCLIENTS C
sk
sk c C occur client
sk
sk c if sock <> -1
sk
sk c if FD_ISSET(sock: readset)
sk c if ReadClient(C) < 0
sk c callp EndClient(C)
sk c callp FD_CLR(sock: excpset)
sk c callp FD_CLR(sock: writeset)
gpk * Load socket data from input buffer, do custom processing,
gpk * and load the ACK to the output buffer...
gpk C Else
gpk C Eval IscketData = *Blanks
gpk C Eval IscketData = rdbuf
gpk C Exsr ReadIscket
gpk C Eval wrbuflen = %Len(OscketData)
gpk C Eval wrbuf = OscketData
sk c endif
sk c endif
sk
sk c if FD_ISSET(sock: writeset)
sk c if WriteClient(C) < 0
sk c callp EndClient(C)
sk c callp FD_CLR(sock: excpset)
sk c callp FD_CLR(sock: writeset)
sk c endif
sk c endif
sk
sk c if FD_ISSET(sock: excpset)
sk c callp EndClient(C)
sk c endif
sk
sk c endif
sk
sk c enddo
sk C*------------------------
sk CSR endsr


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.