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



I would assume that this is a bug in your program... If you're not sure, I'd try sniffing the connection to verify that the duplicated data isn't really being sent over the network.

However, I can't see anything in the part of the code you posted that would cause this -- then again, the part of the code you posted seems to be checking the output of select(), and NOT where you read the data from the socket, and tells nothing about how you're buffering it, so I would look in other areas of your code, if I were you.

in particular, make sure that when you read data from the read buffer for the socket (I'm assuming you maintain a read buffer for each socket in the MODS) you have to make sure that you remove the data you've read, and never ever read it again.


GKern@xxxxxxxxxxxxxxxx wrote:
Repost from accidental post to Midrange-L:

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.