Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to index page
Thread view  Board view
cpcdos(R)

Homepage E-mail

FRANCE [Jura],
19.03.2015, 11:17
 

Watt32 multi-client ? (Announce)

Hi all :-)

I want to know if watt32 is able to support multi-client/multi-socket ?
Because, when 1 client connect to my tcp server (with a basic c# application), if another client connect in same time, his c# application return "SOCKET ERROR #10061". So I must wait that client is deconnected... :-(

I have my c code (compiled with gcc) :
#--------------------------------------------------------------#
// All include for my project
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <dpmi.h>
#include <sys/djtypes.h>
#include <sys/movedata.h>
#include <sys/segments.h>
#include <go32.h>
#include "pth.h"
// reseau (Ping + http + serveur tcp)
#include <time.h>
#include <process.h>
#include <sys/socket.h>
#include <netinet/in_systm.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/ip_icmp.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <tcp.h>
#include <limits.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <io.h>
#include <dos.h>
#include <setjmp.h>

// My tcp program :

char Buffer_TCP[102400];
char reception [1024];
int t;
tcp_Socket srv_tcp;
sock_init();

// Open port 1234

tcp_listen (&srv_tcp, 1234, 0, 0, NULL, 0);
sock_mode (&srv_tcp, TCP_MODE_ASCII); // ASCII mode

while(1){

while(tcp_tick(&srv_tcp))
{
if (sock_dataready(&srv_tcp))
{
TRY {
// GET request
sock_gets (&srv_tcp, reception, sizeof(reception));


strcat(Buffer_TCP, "A new request :");
strcat(Buffer_TCP, reception);

// Send OK
t = sock_puts (&srv_tcp, "Ok");

// Close socket
t = sock_close (&srv_tcp);
sock_wait_closed(&srv_tcp, 1 , NULL, &status);
goto ok;
}
CATCH{
goto sock_err;
}
END_TRY;
}
}
}
sock_err:
sock_close (&srv_tcp);
return NULL;
ok:
// And after he return Buffer_TCP
return Buffer_TCP;
}
#--------------------------------------------------------------#

Thank you

---
FAVIER Sébastien
http://cpcdos.fr.nf/

ps: Excuse my for my English level, I'm a French student

Back to index page
Thread view  Board view
15108 Postings in 1358 Threads, 246 registered users, 13 users online (0 registered, 13 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum