Esempio n. 1
0
bool cByteBuffer::SkipRead(int a_Count)
{
	CHECK_THREAD;
	CheckValid();
	ASSERT(a_Count >= 0);
	if (!CanReadBytes(a_Count))
	{
		return false;
	}
	AdvanceReadPos(a_Count);
	return true;
}
Esempio n. 2
0
int main(int argc, char **argv)
{
   char machine[500];
   int port, timeout, arg;

   if (argc < 4)
      Usage();

   for (arg = 1; arg < argc; arg++)
   {
      if (argv[arg][0] != '-' && argv[arg][0] != '/')
	 break;

      switch (argv[arg][1])
      {
      case 'D':
      case 'd':
	 debug = True;
	 break;

      default:
	 printf("Ignoring unknown option %c\n", argv[arg][1]);
	 break;
      }
   }   

   if (arg + 2 >= argc)
      Usage();

   strcpy(machine, argv[arg]);
   sscanf(argv[arg + 1], "%d", &port);
   sscanf(argv[arg + 2], "%d", &timeout);

   dprintf("machine name = %s, port = %d\n", machine, port);

   if (!OpenSocketConnection(machine, port))
   {
      dprintf("Socket open failed!\n");
      return 1;
   }

   if (!CanReadBytes(timeout))
   {
      dprintf("Can't read bytes from server!\n");
      return 1;
   }

   dprintf("Connection normal.\n");
   return 0;
}