matwachich Posted August 29, 2015 Posted August 29, 2015 (edited) Here I am again, with a brand new UDF! (not so new through...)Taking (great) advantage of the new maps feature, I made a simple, flexible multi-clients TCP server UDF.Features:You can create multiples servers in one scriptPeers limit is optional (the real peers limit is your RAM and the maps performances)You can configure max data receive len (2nd argument of TCPRecv) on a per-client basisYou can set an optional idle time-out (time without receiving any data before peer gets disconnected)Each peer has an empty Map that can contain user defined dataYou can set a function that will be called for each connected peer at pre-defined interval (onPeerCycle callback)The UDF is callback driven (onConnect, onDisconnect, onReceive, onError, onPeerCycle)You can set a disconnect message when kicking a peer. This message will be passed to the onDisconnect callbackonReceive callback must return the number of bytes that have been consumed. Say you receive 100 bytes of data but you used (consumed) only 70 bytes, by returning 70 from the callback the remaining 30 bytes will be buffered and passed again on the next call to onReceiveKnown bugs:TCPRecv bug! the function doesn't detect peer disconnection (hope this will be fixed soon)Download:https://github.com/matwachich/generic-tcp-server/ Thanks in advance for your feedback! Edited August 29, 2015 by matwachich argumentum 1
tatane Posted March 8, 2018 Posted March 8, 2018 Hi matwachich ! I tried your clients/server and I've got the problem you mentionned about TCPRecv... Did you find a workaround to detect disconnection ? Thanks for your work.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now