sockets

From: Sam (spe_at_x-media.fr)
Date: 06/29/04


Date: Tue, 29 Jun 2004 16:56:57 +0200

Hi guys, Just a problem with sockets

I've done a little C client/server

Server side, "classic" :

...
while (true)
  {
    sd_client = accept(sd,(struct sockaddr *)&cin,&addrlen);

   n = recv(sd_client,buffer,sizeof(buffer),0);

   buffer[n]=0;
   printf("from cli : %s\n", buffer);

   sprintf(buffer, "ok %d\n", j++);
   if (send(sd_client,buffer,strlen(buffer),0) == -1)
      {
      perror("send");
      exit(1);
      }

   close (sd_client);
}

But now, when I try to connect to the client:

First connection works perfectly (server receives my stream)

n = send(sd, "hello",strlen("hello"),0);
n = recv(sd, buffer, bufsize,0);
buffer[n]=0;
printf ("from srv : %s\n",buffer);

Now, after that, if I try (again)

n = send(sd, "test 2",strlen("test 2"),0);
n = recv(sd, buffer, bufsize,0);
buffer[n]=0;
printf ("from srv : %s\n",buffer);

This time server doesn't receive datas at all ???

Where is my mistake ?

thanx



Relevant Pages

  • [NEWS] How to Remotely and Automatically Exploit a Format Bug
    ... Exploiting a format bug remotely is not as difficult as one would think. ... We will use very minimalist server along this paper. ... Since the buffer is directly available to a malicious user, ... Guessing the address of the shellcode in the stack ...
    (Securiteam)
  • Re: smbclient timeout, file truncated / 9.1 Pro (was Re: libpopt.so.0 conflict...
    ... >and the OS/2 machines on the LAN. ... NETBEUI was invented to allow windows clients to use an OS/2 server. ... 9 buffer small read and write requests until the buffer is full ... Acknowledgment Timeout ...
    (alt.os.linux.suse)
  • [UNIX] Multiple Vulnerabilities in Citadel/UX
    ... could allow complete control over a vulnerable server. ... Citadel server as can be seen by this simplistic code snippet: ... configuration buffers, leading to the possibility of carrying out a buffer ... int connect_to_host; ...
    (Securiteam)
  • Re: Samba HOWTO
    ... but I see no reason why eCS or Warp Server ... OS/2 LAN Requester initialization file ... 9 buffer small read and write requests until the buffer is full ... Acknowledgment Timeout ...
    (comp.os.linux.networking)
  • Re: TCPBEUI misbehaving
    ... >> I try to analyse problems on my network. ... The wrkheuristics parameter sets a variety of requester fine-tuning ... 9 buffer small read and write requests until the buffer is full ... 27 force correct open mode when creating files on a core server (reserved ...
    (comp.os.os2.setup.misc)