This might not be the best approach but I would read the stream one packet at a time. Guard for the occurence of CRLF/CRLF to determine the header boundary. Parse the headers and find Content-Length. If > 0, Do a Read( int len ) using the Content-Length or you could still use byte per byte read until CRLF/CRLF to determine the Body boundary.
Joegen Scott Lawrence wrote: > On Wed, 2006-07-19 at 01:01 -0700, Mushtaq Ilyas wrote: > >> Hello >> SIP protocol supports both TCP and UDP as transport protocols. What is >> the maximum SIP message size if there is any? I see the 64k limit in >> case of UDP. >> How would one know what size of buffer to allocate to receive a TCP >> message. I know that there is the content length header in the SIP >> message but how would I knwo what length to receive before I can parse >> and find the content length header? >> > > You can't know in advance. You do have the option of just rejecting > anything that is over whatever maximum you pick, but note that you have > to close the TCP connection if that happens, because you won't be able > to find the message boundaries. > > _______________________________________________ Sip-implementors mailing list [email protected] https://lists.cs.columbia.edu/cucslists/listinfo/sip-implementors
