Thanks Josh!
var buffer = "";
function parsePacket(buff) {
//parse packet from buff.
//return rest-buff;
}
var net = require('net');
var server = net.createServer(function(c) { //'connection' listener
console.log('server connected');
c.on('data', function(data) {
console.log("raw data: "+data.toString());
buffer += data.toString();
buffer = parsePacket(buffer);
});
c.on('end', function() {
console.log('server disconnected');
});
});
xzYue
ps:
http://cnodejs.org/user_data/images/4fbdfc92f37132d6300c89f6/4fbdfc92f37132d6300c89f61337851645346.png
On 5月25日, 上午8時42分, Joshua Holbrook <[email protected]> wrote:
> What is `buffer`? What is `parsePacket`?
>
> --Josh
>
> On Thu, May 24, 2012 at 5:38 PM, xzYue <[email protected]> wrote:
> > No one meet this kind of problems?
> > xzYue
>
> > On 5月24日, 下午8時03分, xzYue <[email protected]> wrote:
> >> Any idea?
>
> >> On 5月24日, 上午11時17分, xzYue <[email protected]> wrote:
>
> >> > Hi all,
> >> > I created a tcp server using nodejs codes below:
>
> >> > var net = require('net');
> >> > var server = net.createServer(function(c) { //'connection' listener
> >> > console.log('server connected');
>
> >> > c.on('data', function(data) {
> >> > console.log("raw data: "+data.toString());
> >> > buffer += data.toString();
> >> > buffer = parsePacket(buffer);
> >> > });
>
> >> > c.on('end', function() {
> >> > console.log('server disconnected');
> >> > });
>
> >> > });
>
> >> > After a period of time,it stops data receiving.
> >> > I catch some packets using Wireshark.
> >> > A lot of TCP ZeroWindow errors.
> >> > I find the connection from the tcp client created by Java or C++
> >> > appears this issues, but the nodejs tcp client is fine.
>
> >> > Any replies are welcome.
> >> > xzYue
>
> > --
> > Job Board:http://jobs.nodejs.org/
> > Posting
> > guidelines:https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> > You received this message because you are subscribed to the Google
> > Groups "nodejs" group.
> > To post to this group, send email to [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]
> > For more options, visit this group at
> >http://groups.google.com/group/nodejs?hl=en?hl=en
>
> --
> Joshua Holbrook
> Engineer
> Nodejitsu Inc.
> [email protected]
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en