From 653afd7f880637e5ffec53830a8757d55ab017e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Wed, 4 May 2016 19:53:01 +0000 Subject: [PATCH] [GB.NET] * BUG: ServerSocket: Handle all error codes when listening. git-svn-id: svn://localhost/gambas/trunk@7759 867c0c6c-44f3-4631-809d-bfa615b0a4ec --- gb.net/src/CServerSocket.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gb.net/src/CServerSocket.c b/gb.net/src/CServerSocket.c index b7e902a71..93fb0a8c9 100644 --- a/gb.net/src/CServerSocket.c +++ b/gb.net/src/CServerSocket.c @@ -119,7 +119,8 @@ static void CServerSocket_CallBackUnix(int fd, int type, intptr_t lParam) /********************************************************* Starts listening (TCP/UDP/UNIX) **********************************************************/ -static int do_srvsock_listen(CSERVERSOCKET* _object,int mymax) + +static int do_srvsock_listen(CSERVERSOCKET* _object, int mymax) { int retval; int auth = 1; @@ -129,7 +130,8 @@ static int do_srvsock_listen(CSERVERSOCKET* _object,int mymax) if (SOCKET->status > NET_INACTIVE) return 1; - if (mymax<0) return 13; + if (mymax < 0) + return 13; if (THIS->type == NET_TYPE_LOCAL && !THIS->sPath) return 7; @@ -220,9 +222,12 @@ static void srvsock_listen(CSERVERSOCKET *_object, int max) switch(do_srvsock_listen(THIS, max)) { case 1: GB.Error("Socket is already listening"); break; + case 2: GB.Error("Cannot create socket"); break; case 7: GB.Error("Path is not defined"); break; case 8: GB.Error("Port is not defined"); break; + case 10: GB.Error("Cannot bind to socket"); break; case 13: GB.Error("Invalid maximum number of connections"); break; + case 14: GB.Error("Cannot listen on socket"); break; case 15: GB.Error("Unable to bind socket to interface"); break; default: break; }