Пример #1
0
void CPROC ServerReadComplete( PCLIENT pc, POINTER buffer, int len )
{
	if( !buffer )
	{
      buffer = Allocate( 4096 );
	}
	else
	{
      SendTCP( pc, buffer, len );
	}
   ReadTCP( pc, buffer, 4096 );
}
Пример #2
0
void CPROC ReadComplete( PCLIENT pc, void *bufptr, int sz )
{
   char *buf = (char*)bufptr;
	if( buf )
	{
		IdleFor( 500 );
		buf[sz] = 0;
		printf( "%s", buf );
		fflush( stdout );
	}
	else
	{
		buf = (char*)Allocate( 4097 );
      //SendTCP( pc, "Yes, I've connected", 12 );
	}
	ReadTCP( pc, buf, 4096 );
}
Пример #3
0
void CPROC ServerRecieve( PCLIENT pc, POINTER buf, size_t size )
{
   //int bytes;
	if( !buf )
	{
		buf = Allocate( 4096 );
     // SendTCP( pc, (void*)"Hi, welccome to...", 15 );
	}
    //else
	 //   SendTCP( pc, buf, size );

	 // test for waitread support...
    // read will not result until the data is read.
	 //bytes = WaitReadTCP( pc, buf, 4096 );
			 //if( bytes > 0 )
	 //   SendTCP( pc, buf, bytes );

	ReadTCP( pc, buf, 4095 );
   // buffer does not have anything in it....
}
Пример #4
0
void CPROC ClientReadComplete( PCLIENT pc, POINTER buffer, int len )
{
	if( !buffer )
	{
		buffer = Allocate( 4096 );
	}
	else
	{
      uint64_t del;
		SetTick( l.end );
		l.accum += (del = l.end - l.start);
		l.passes++;
		l.bytes += len;
		if( (!l.min) || ( del < l.min ) )
			l.min = del;
		if( del > l.max )
			l.max = del;
      l.waiting = 0;
	}
   ReadTCP( pc, buffer, 4096 );
}