El Miércoles, 20 de Enero de 2010, LIU Liping escribió: > hi all, > When TCP is used as transport lay for SIP messages. Maybe the SIP > Stack can read some data from socket which includes more than one sip > message and maybe the SIP stack can read only a part of a sip message. > So, now Is it the stack's duty to determine the sip message boundaries > by the START LINE and content length? Is there any protocols to > regulate the stack's behaviour?
SIP TCP messages (requests and responses) MUST contain Content-Lentgth header indicating the exact byte size of the body, so when processing a TCP request or response you must read upto "Content-Length" bytes (after finding an empty line = \r\n\r\n). If you detect an error (the buffer doesn't contain "Content-Length" bytes after a while, or you detect a malformed request/response) a classic approach is closing the TCP connection. Of course this is not a very cool solution as it involves loosing pending replies in that conection. However IMHO is the simplest and most effective approach. -- Iñaki Baz Castillo <[email protected]> _______________________________________________ Sip-implementors mailing list [email protected] https://lists.cs.columbia.edu/cucslists/listinfo/sip-implementors
