TCP Client Connection

前端 未结 3 895
小鲜肉
小鲜肉 2021-01-05 08:25

I have an application that I have written for my application distributed throughout the company to send data to me through our Windows 2003 server (running IIS 6.0). Small t

3条回答
  •  盖世英雄少女心
    2021-01-05 09:11

    If I read your code correctly, you've basically got (sorry for the c-style - I'm not good with c#:

    do
    {
      socket = accept();
      read(socket, buffer);
    }while(not_done);
    

    If I'm correct, then it means you need... a little more in there. If you want it to be serialized, reading each upload in sequence, you'll want a second loop:

    do
    {
      socket = accept();
      do { read(socket, buffer); not_done_reading=...; } while (not_done_reading);
    }while(not_done);
    

    If you want to read multiple uploads simultaniously, you'll need something more like:

    do
    {
      socket = accept();
      if( !fork() )
      {
        do { read(socket, buffer); not_done_reading=...; } while (not_done_reading);
      }
    }while(not_done);
    

提交回复
热议问题