On Wed, Jul 04, 2007 at 05:25:02PM +0200, katsanqat wrote: > Hmm try this function. For example do a connect() to a server that > does not exist and check the return value. if it is -1 then connect() > did not succed. There you throw your super function below: > > int ret = connect(sock, (struct sockaddr *)&ServAddr, sizeof(ServAddr)); > if (ret == -1) socket_error("connect"); > ... > void socket_error(char *msg) > { > #ifdef WIN32 > LPVOID lpMsgBuf; > FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |FORMAT_MESSAGE_FROM_SYSTEM | > FORMAT_MESSAGE_IGNORE_INSERTS, NULL,WSAGetLastError(), 0, (LPTSTR)&lpMsgBuf, > 0, NULL); > char str[1024]; > sprintf(str,"%s : %s", msg, (LPCTSTR)lpMsgBuf); > LocalFree(lpMsgBuf); > //MessageBox (NULL,str,"Socket Error",MB_OK | MB_ICONEXCLAMATION); > printf("%s\n",str); > #else > perror(msg); > #endif > } > > There are other defines needed for example windows is using the type > SOCKET whereas BSD Sockets use an int. ... Thanks for the example! This is exactly the reason why I looked for a library :) . It would cost me and future maintainers of the application much more to develop that in-house than to learn a new API and regularly update the library -- you learn and define the process only once. With kind regards, -- Baurzhan Ismagulov http://www.kz-easy.com/ _______________________________________________ gtk-list mailing list gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list