NetTalk Central
NetTalk Web Server => Web Server - Ask For Help => Topic started by: Wolfgang Orth 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
-
>> 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
-
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
-
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
-
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).
-
> 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