NetTalk Central

Author Topic: SimpleServer: getting hit several times  (Read 2997 times)

Wolfgang Orth

  • Sr. Member
  • ****
  • Posts: 251
    • View Profile
    • oData Wolfgang Orth
SimpleServer: getting hit several times
« on: May 18, 2011, 04:48:12 AM »
Hello all and Bruce,

to see and learn, how a string (XML) arrives to a SimpleServer, I added DebugOutputs to .Process()

What I saw in DebugView is that the branche

  case self.Packet.PacketType
     of NET:SimplePartialDataPacket

gets hit several times. Sometimes I see 3, sometimes 4 hits, but only the first hit holds the received data in self.Packet.BinData. The subsequent ones were obviouly empty.

Anyway, it makes me a bit nervous to see .Process() acting so many times.

Other than the webserver, which has unlimited packet size, teh SimpleServer is restricted to 16k. I want to make sure that I receive all data of that XML. My idea was to collect and concatenate each incoming packet into a StringTheory object until a specific substring "</root>" is detected. Then I know I got it all.

But the fact that PartialDataPacket reports incoming data several times, albeit they are empty, makes me hesitating. :-\

Or is this something I can ignore?

tia
Wolfgang



Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11193
    • View Profile
Re: SimpleServer: getting hit several times
« Reply #1 on: May 18, 2011, 07:31:17 AM »
>> Sometimes I see 3, sometimes 4 hits, but only the first hit holds the received data in self.Packet.BinData. The subsequent ones were obviouly empty.

That's the way TCP/IP works.

If you send 1 packet from one computer it can arrive as multiple packets.
In the same way if you send 3 packets, it can arrive as 1 packet.

You're used to the WebServer doing all the "putting back together" for you, but with NetSimple you have to do it yourself.

Cheers
Bruce

ccordes

  • Sr. Member
  • ****
  • Posts: 384
    • View Profile
    • Email
Re: SimpleServer: getting hit several times
« Reply #2 on: May 18, 2011, 07:43:27 AM »
Regarding the "Putting back together"... is this something we should be doing?

I have a web server communicating with FedEx using NetWebClient. because of the resolution of the their label graphics, we receive huge xml strings about 500k. They seem to return all in one lump. At least I have not coded anything that puts things back together.
I was going to answer Wolfgang not to worry too much about the size, but you just put the fear of new realizations in me <g>.

chris
Real programmers use copy con newapp.exe

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11193
    • View Profile
Re: SimpleServer: getting hit several times
« Reply #3 on: May 18, 2011, 08:40:14 PM »
No, nothing for you to worry about Chris. NetWebClient does all the heavy-lifting for you. WG is using NetSimple at a lower level, not netWebClient.

Cheers
Bruce

seancameron

  • Newbie
  • *
  • Posts: 16
    • View Profile
    • CapeSoft Software
Re: SimpleServer: getting hit several times
« Reply #4 on: May 31, 2011, 04:27:32 AM »
None of the NetTalk objects have any limitations in terms of the amount of data that can be sent and received. The lower level classes are packet based, so larger amounts of data should be split into packets. The example demonstrates splitting and assembling the packets. This is why Process is (and should be) called multiple times when more than one packet is received.

The higher level classes handle this for you, and in fact even the NetSimple class will handle this for you if you have a NetSimpleClient and NetSimpleServer (see the WholePacket example).
Sean Cameron
CapeSoft
www.capesoft.com

Work Smarter, Not Harder

Wolfgang Orth

  • Sr. Member
  • ****
  • Posts: 251
    • View Profile
    • oData Wolfgang Orth
Re: SimpleServer: getting hit several times
« Reply #5 on: June 15, 2011, 10:41:31 AM »
> NetSimpleClient and NetSimpleServer (see the WholePacket example).

Right, but one has to be aware this works only between Client and Server, when both are Nettalk-made.

Communicating with another non-Clarion/Nettalk tool requires PartialData only.

Wolfgang