I have very simillar situation, my clients (embedded units connected through GPRS) expect some sequence of bytes from server after connecting. Clients are able to send their data after they receive this starting sequence. I just send sequence of bytes in OnClientConnect events of server socket - it seems to work fine without any problem.
Lukas

I'm using TWSocketServer to handle multiple incoming connections from a client's embedded unit.

Unfortunately the remote unit has a few limitations; the main one being that it can establish an IP connection to a server but cannot send data until the server requests it.

This means that although the OnClientConnect function gets called, the OnDataAvailable does not.

I had put a line of code in the OnClientConnect to trigger the OnDataAvailable function
but this seems to be blocking other connections.

You should not do that. OnDataAvailable is triggered when the other side has sent data.

My questions are:-
i) Is there a way to trigger the OnDataAvailable function by post a message on the socket.

No way. Well, no way that has real meaning.

ii) Is there a better way to do this without going to a threaded model.

No need to go multithreaded. You said: "cannot send data until the server requests it". This is the solution: once the embedded unit is connected send the request it waits. Probably the banner property is the place where you could place you request because banner is what the server component sent immediately when a client connect.

BTW and for my information, what kind of unit is this and what kind of request does it needs ?

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

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



--
lukas skala
envinet a.s.
divize projektu a inzenyringu (project and engineering division)
modrinova 1094
674 01 trebic

tel: +420 568 409 862 (811)
fax: +420 568 409 875
gsm: +420 724 461 062
icq: 66842878
eml: lukas.sk...@envinet.cz, luky.sk...@gmail.com
www: http://envinet.cz




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