Re: [twsocket] OnClientDataAvailable
- Original Message - From: "Robert Haditama" <[EMAIL PROTECTED]> To: "ICS support mailing" Sent: Monday, October 03, 2005 12:14 PM Subject: Re: [twsocket] OnClientDataAvailable > Just now, fortunately, i can repeat the situation so > that the problem raise. Using the log in the > onclientdataavailable, i see that when the client send > the 98th, the server receive the 97th message (that's > already been processed before). Client send the 99th, > server receive the 97th (again) and the 98th (no > 99th). Client send the 100th, server receive the 97th > & the 98th (again), and also the 99th. Just like that, > goes on and on. But at the same time, the other client > is processed correctly. > What's wrong ? > > Robert. > Post some code, its hard to know whats wrong without. If I remember correctly, isClient lets you pass a pointer/object and will return true if its a client of the twsocketserver. Dan -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] OnClientDataAvailable
Just now, fortunately, i can repeat the situation so that the problem raise. Using the log in the onclientdataavailable, i see that when the client send the 98th, the server receive the 97th message (that's already been processed before). Client send the 99th, server receive the 97th (again) and the 98th (no 99th). Client send the 100th, server receive the 97th & the 98th (again), and also the 99th. Just like that, goes on and on. But at the same time, the other client is processed correctly. What's wrong ? Robert. __ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] OnClientDataAvailable
Hello Robert, > But i suspect maybe there is something 'wrong' in > server's message pump (i am using ics messageloop). It is very basic, cannot go mutch wrong with it. I hope it is only called in the Execute method of your thread ? > Other question: what is exactly 'IsClient' do? Sorry I dont understeand what you mean ;( --- Rgds, Wilfried http://www.mestdagh.biz -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] OnClientDataAvailable
> So there is something wrong between the point where > the client log it > and the point where the server log it. Please veryfy > then with > SocketSpy. OK, i will. But i suspect maybe there is something 'wrong' in server's message pump (i am using ics messageloop). Can i put a log on the message pump ? Other question: what is exactly 'IsClient' do? Robert. __ Yahoo! for Good Donate to the Hurricane Katrina relief effort. http://store.yahoo.com/redcross-donate3/ -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] OnClientDataAvailable
Hello Robert, > I have, not only in the server, in the client also. > And the logs show that the client has sent the right > message (the 98th), the server has got it as the 98th > message, but it contains exactly the 97th. So there is something wrong between the point where the client log it and the point where the server log it. Please veryfy then with SocketSpy. --- Rgds, Wilfried http://www.mestdagh.biz -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] OnClientDataAvailable
--- Wilfried Mestdagh <[EMAIL PROTECTED]> wrote: > Hello Robert, > > If I understeand whell it seems that you receive a > particular packet > double ? This is impossible with TCP. > No, its not double. Example : at 14:00:01, client 1 send the 97th message. (1st message to 96th message is received and processed right), at 14:00:01, server received the message. Then process it, no 'funny' thing at this point. After that, the server send a reply message. -- finish process for the 97th message. at 14:15:01, client 1 send the 98th message. at 14:15:01, server's onclientdataavailable is triggered (because of there is a new message received, right?), but the message is exactly that 97th message, not the 98th message. This problem is not always happened at 98th message, can be before or after it, or not hapenning at all. > First of all check if it is the sender or the > receiver that fails. You > can easy check this with SocketSpy where you can log > the traffic between > them. > > If it is receiver, I suggest you log in > OnDataAvailable. To be very sure > of message pump usage (unless you are 100% sure no > object is called that > use it) you can also increment / decrement a counter > on enter / leave of > the event and log it also. > I have, not only in the server, in the client also. And the logs show that the client has sent the right message (the 98th), the server has got it as the 98th message, but it contains exactly the 97th. > --- > Rgds, Wilfried > http://www.mestdagh.biz > > -- > To unsubscribe or change your settings for TWSocket > mailing list > please goto > http://www.elists.org/mailman/listinfo/twsocket > Visit our website at http://www.overbyte.be > Robert. __ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] OnClientDataAvailable
Hello Robert, If I understeand whell it seems that you receive a particular packet double ? This is impossible with TCP. First of all check if it is the sender or the receiver that fails. You can easy check this with SocketSpy where you can log the traffic between them. If it is receiver, I suggest you log in OnDataAvailable. To be very sure of message pump usage (unless you are 100% sure no object is called that use it) you can also increment / decrement a counter on enter / leave of the event and log it also. --- Rgds, Wilfried http://www.mestdagh.biz -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] OnClientDataAvailable
Thanks for the quick respond. > Make sure that you never call > Application.ProcessMessages (Or > Showmessage()) from your OnClientDataAvailable > handler. No, there is no ProcessMessages or ShowMessage. > Also, remember > that if you send two messages from your client: > > Hi > there > > The server may receive them as: > Hi > there > > Or it may receive them as: > Hithere > > Or it may receive them as: > H > i > t > h > ere > > It is up to you to write a protocol that allows you > to separate > different messages out. > I am using LineMode (True) and LineEnd := #13#10. Actually this problem is not always happen, and not all clients face it. Is there anything else for me to check? Robert. __ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] OnClientDataAvailable
Robert Haditama wrote: >Hi, >I am using threaded twsocketserver, and the logic is >similar to ThrdSrv (the example application). There >are about 30 clients connected, and send periodically >1 message until in total about 100 messages. For every >message, the server should retrieve, update, or insert >some data to oracle database. After that, it will send >a reply message to the client. The problem is, >sometimes the message that is received in >OnClientDataAvailable event is not received correctly. >Eg. Client 1 send the 97th message, it will received >and processed correctly. But at 98th message, seem >that it received and processed the 97th message (the >message is exactly different). But after Client 1, >disconnect, socket is closed, reconnect again, and >send the 98th message, it will get it right. This >problem is not happenning everytime, and not every >client have it. > > Make sure that you never call Application.ProcessMessages (Or Showmessage()) from your OnClientDataAvailable handler. Also, remember that if you send two messages from your client: Hi there The server may receive them as: Hi there Or it may receive them as: Hithere Or it may receive them as: H i t h ere It is up to you to write a protocol that allows you to separate different messages out. Cheers, Nicholas Sherlock -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be