Hi,

Mostly when there is data packet of several length there is a length byte, or a packet type where you can see what kind of data it is (and the length of it). In the first case I see 21 as second byte and the packet you show is 33 long. So probably 21 is the length. In that case you check second byte to know how mutch to receive.

If all packets start with the same byte then you can set start byte as LineEnd, but then you receive only a package when next package is arrived. Of course the byte (or sequence) may not be in the data (normally it is never).

Met vriendelijke groeten,
Wilfried Mestdagh

Op 29-12-16 om 08:12 schreef sxbug:
Hi sir:
My Clients are some GPRS moudle, they send some HEX data,like : FA 21 02 FF 00 
13 20 00 08 FF AA 55 00 00 00 00 00 00 00 00 00 00 00 13 00 00 00 01 FF FF FF 
F6 00


     I found OverbyteICSTcpSrv.dpr can achieve my need. but it only recieve 
string include #13#10. How can I deal with ?
      Thank you !!!




                           sun xiao








At 2016-12-28 17:54:36, "François Piette" <francois.pie...@skynet.be> wrote:
1, wsocketServer can achieve this function?
As its name implies, TWSocketerver is the component you'll use at the server
side (The one waiting for connections from client).
You shall use TWSocket at client side (The one which initiate the connection
to the server).

2, need to use linemode? Its lineEnd how to set? Do not set up, wrong, how
to deal with?

You shall use LineMode if and only if the messages you send are ALL
terminated by the same characters (One of more, default is CR LF pair).
You set LineMode Boolean property to change the behavior.

3, need to enable MulitiThreaded?
You shall probably not use multithread. ICS components multitask without the
need of multithread. You'll only need multithreading if you have lengthy
computation or length database (or similar) access.

4,How do WSocketServer receive data ,Is it by ClientDataAvailable?
TWSocketServer by itself doesn't receive any data, it waits for client
connection. When one client is connecting, TWSocketServer instanciate a
TWSocket to handle that particular client communication.

Have a look at OverbyteIcsSrvTcp.dpr, OverbyteIcsTcpSrv.dpr or
OverbyteIcsTnSrv.dpr projects if you build a GUI server, or
OverbyteIcsSrvTcp.dpr project if you build a service for the server.

Have a look at OverbyteIcsClient7.dpr project to start your client prject.

Seasons greetings,
--
francois.pie...@overbyte.be
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be



-----Message d'origine-----
De : TWSocket [mailto:twsocket-boun...@lists.elists.org] De la part de sxbug
Envoyé : mercredi 28 décembre 2016 08:12
À : twsoc...@elists.org
Objet : [twsocket] I want to receive bin string by wsocketserver

Sir, thank you for your great works.
I want to receive/send binary string by WSocketServer. My client is a GPRS .
1, the send string is binary data , its length maybe 10 byte, 17 byte, 24
byte,  and 40byte   etc.
2, the send data began as 16 hexadecimal fixed:  FA 21
3, the end of the data's character is  arbitrary .
4, after receiving data, do some data analysis, and write some msg to
database.


There are a few questions to consult ICS Component,
1, wsocketServer can achieve this function?
2, need to use linemode? Its lineEnd how to set? Do not set up, wrong, how
to deal with?
3, need to enable MulitiThreaded?
4,How do WSocketServer receive data ,Is it by ClientDataAvailable?


Could you pleased give me some code for this function?
         Thanks


                                               Sun Xiao
--
To unsubscribe or change your settings for TWSocket mailing list please goto
http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be





--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to