Jump to content
Fórum Script Brasil
  • 0

Sockets


jose4469

Question

Eu estou implementado um cliente/servidor, tá da seguinte forma:

O cliente:

#include <stdlib.h>

#include <stdio.h>

#include "rc-net-lib.h"

main() {

int descritor, nB;

char *identificacao[7];

descritor = rc_connect("193.137.179.82", 9020, 0);

if (descritor == -1) { exit(1); }

identificacao = "rc98765";

nB = rc_send(descritor, identificacao, sizeof(identificacao));

rc_close(descritor);

}

O servidor:

#include <stdio.h>

#include <stdlib.h>

#include "rc-net-lib.h"

main() {

int descritor, r;

char *identificacao[7];

descritor = rc_listen(9020, 0);

if (descritor == -1) { exit(1); }

r = rc_recv(descritor, identificacao, sizeof(identificacao));

rc_close(descritor);

}

O meu socket tá implementado em rc-net-lib.h...

Eu queria saber que função eu uso pro servidor terminar a ligação se não receber a identificação do cliente até 2s após a ligação ser estabelecida,

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...