First - You may want to look at some libraries that already do that, jabberoo (Linux, win32). JabberCOM (COM based win32) and there are some java libs as well.
If you need to make your own, you should look at jabberoo for some ideas. I assume your lib is based on a select (or poll) loop, when select (or poll) returns with > 0 you need to read (or recv) on the active file descriptor(s). Both functions (read or recv) will work for you in linux but you need to use recv in win32. So you create a static buffer of whatever size you want (4 or 8k is usually good). You pass that to recv which fills it. Your lib needs to employ a SAX XML parser which you can pass the recv'd data to. If the data in the recv kernel buffer is larger than you can read you will get the rest on the next time through the select loop, pass it on to the parser. At that point the lib needs to use some kind of callback mechanism to call the app that is using the lib. Glenn ----- Original Message ----- From: "Rohit Nadhani" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, April 24, 2002 7:44 AM Subject: [JDEV] Jabber Client - Sockets problem > Hello, > > I am developing a Jabber client using sockets. > > Before calling the recv() function, I need to know one > of the following: > > - the message seperator so that I can recv() upto the > seperator > - the no of bytes I need to recv() > > I can't fix the buffer size, since the incoming > message can be of any length. > > Can somebody suggest me the right way to recv() a > message from the Jabber server? > > Thanks in advance, > > Rohit > > __________________________________________________ > Do You Yahoo!? > Yahoo! Games - play chess, backgammon, pool and more > http://games.yahoo.com/ > _______________________________________________ > jdev mailing list > [EMAIL PROTECTED] > http://mailman.jabber.org/listinfo/jdev > _______________________________________________ jdev mailing list [EMAIL PROTECTED] http://mailman.jabber.org/listinfo/jdev