C++ Sockets

C++ Sockets is a cross-platform C++ wrapper for BSD-style sockets. It implements the TCP, UDP, ICMP, and SCTP transport layer protocols. Implemented application layer protocols are HTTP/HTTPS (using OpenSSL), SMTP (server), and Ajp/1.3 (server). Features include transparent SOCKS4 client support and asynchronous DNS. Included in the library are a number of HTTP client functions such as GET/PUT/POST, and also Web server framework components.

Tags Networking Communications
Licenses GPL
Operating Systems Windows POSIX Linux Solaris Mac OS X
Implementation C++

Tweet this project Short link

Rss Recent releases

  • Rrelease-mid
  •  20 May 2009 15:29
  • Rrelease-after

Changes: Initialization problems with OpenSSL and Win32 were fixed. A default interface for multicast was added. A crashing problem with getnameinfo on Mac OS X was fixed.

  • Rrelease-mid
  •  13 May 2009 10:19
  • Rrelease-after

Changes: Some .cpp files were missing namespace declarations and have been fixed. Some includes for IPv6 were missing and have been fixed. Operators in the StreamWriter class were modified to work on 64-bit as well as 32-bit systems.

  • Rrelease-mid
  •  23 Dec 2008 14:22
  • Rrelease-after

Changes: A deadlock in SSLInitializer that was introduced in 2.3.2 was fixed. A check was added for when select() returns -1, indicating that one of the file descriptors has gone bad. The check rebuilds the fd_set used by select(). A bug was fixed in HttpGetSocket: one of the constructors had no support in HttpClientSocket. Bad #include directives in Utility were corrected.

  • Rrelease-mid
  •  06 Nov 2008 20:23
  • Rrelease-after

Changes: A thread-safe list of the SSL initializer, SSL contexts, and OpenSSL error text retrieval. An interface for the Mutex class adds the ability for others to implement the mutex functionality using other approaches. The FromUtf8 method has been moved from XmlNode to Utility.

  • Rrelease-mid
  •  20 Oct 2008 12:17
  • Rrelease-after

Changes: The Remove() method in SocketHandler was changed from private to protected. Utility::Stack was added, which returns a stack walk (currently in Linux only). The $(DESTDIR) variable was added in the Makefile for more flexible installation. The timeout value is now reset before OnTimeout() is called, making it possible to set a new timeout value in the OnTimeout() method.

Rss Recent comments

Rcomment-before 11 Sep 2008 16:14 Rcomment-trans amclellan Rcomment-after

Re: Problem running a program linked with V2.1.7 & V2.3

In fact the problem went away as soon as I compiled the libraries using STLPort.

> I've been using V2.1 and things have

> been working fine. I have recently

> found a problem with the V2.1 and in

> looking at the code it appears that V2.3

> has fixed the issue.

>

> When I attempt to run a program that now

> includes the V2.3 it aborts when

> running. If I switch back to V2.1 it

> runs with the exception noted above.

>

> In order to get my code to compile with

> the V2.3 it was necessary to define

> _WIN32_WINNT=0x0501. This appears to be

> due to the change in socket_include.h

> where winsock2.h is now included instead

> of winsock.h. This change is in

> V2.1.7.

>

> Did anyone else have issues when

> upgrading to the new version?

>

> Can I get a copy of the libraries 2.1.1

> - 2.1.6?

>

>

Rcomment-before 09 Sep 2008 16:41 Rcomment-trans amclellan Rcomment-after

Problem running a program linked with V2.1.7 & V2.3
I've been using V2.1 and things have been working fine. I have recently found a problem with the V2.1 and in looking at the code it appears that V2.3 has fixed the issue.

When I attempt to run a program that now includes the V2.3 it aborts when running. If I switch back to V2.1 it runs with the exception noted above.

In order to get my code to compile with the V2.3 it was necessary to define _WIN32_WINNT=0x0501. This appears to be due to the change in socket_include.h where winsock2.h is now included instead of winsock.h. This change is in V2.1.7.

Did anyone else have issues when upgrading to the new version?

Can I get a copy of the libraries 2.1.1 - 2.1.6?

Rcomment-before 30 May 2007 10:45 Rcomment-trans dilogsys Rcomment-after

Compilation error
...

g++ -Wall -g -MD -D_VERSION='"2.1.6"' -O2 -DLINUX -c -o Sockets-config.o Sockets-config.cpp

g++ -o Sockets-config Sockets-config.o

/usr/lib/gcc/i586-suse-linux/4.1.2/../../../crt1.o: In function `_start':

(.text+0xc): undefined reference to `__libc_csu_fini'

/usr/lib/gcc/i586-suse-linux/4.1.2/../../../crt1.o: In function `_start':

(.text+0x11): undefined reference to `__libc_csu_init'

collect2: ld returned 1 exit status

make: *** [Sockets-config] Error 1

danny:~/installs/Sockets-2.1.6 #

This also happened with 2.1.5. Version 2.1.4 was OK

Rcomment-before 04 Mar 2007 13:24 Rcomment-trans jdthebigj Rcomment-after

Problems in compiling test program in DevC++
Hi,

I am a newbie in C++ programming. I downloaded the zip of source code and tried to compile the test.cpp in DevC++ environment.I have installed OpenSSL but still I am getting following errors. Please help.

Compiler: Default compiler

Building Makefile: "C:\Documents and Settings\Jaideep Padhye\Desktop\Sockets-2.1\Sockets-2.1\DevCpp\Makefile.win"

Executing make...

make.exe -f "C:\Documents and Settings\Jaideep Padhye\Desktop\Sockets-2.1\Sockets-2.1\DevCpp\Makefile.win" all

g++.exe -c ../sockets_test.cpp -o bin/sockets_test.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include" -I".." -DHAVE_OPENSSL

g++.exe bin/sockets_test.o -o "..\..\bin\Test.exe" -L"C:/Dev-Cpp/lib" -L"C:/OpenSSL/lib/MinGW" ../../lib/Sockets.a ../../../../DevCpp/lib/libwsock32.a ../../../../OpenSSL/lib/MinGW/ssleay32.a ../../../../OpenSSL/lib/MinGW/libeay32.a

g++.exe: ../../../../DevCpp/lib/libwsock32.a: No such file or directory

g++.exe: ../../../../OpenSSL/lib/MinGW/ssleay32.a: No such file or directory

g++.exe: ../../../../OpenSSL/lib/MinGW/libeay32.a: No such file or directory

make.exe: *** [../../bin/Test.exe] Error 1

Execution terminated

Rcomment-before 27 Oct 2006 00:08 Rcomment-trans aula1 Rcomment-after

make for Mac OS X
Hi, I'am using Mac OS X 10.2.8 I've recently installed the Operative System.

When I try make Sockets-2.1, I get the following error:

g++ -Wall -g -I. -MD -D_VERSION='"2.1"' -O2 -DMACOSX -DSOCKETS_NAMESPACE=sockets -D_DEBUG -c -o Socket.o Socket.cpp

In file included from Socket.cpp:45:

SocketAddress.h:29: error: parse error before `(' token

SocketAddress.h:29: warning: ISO C++ forbids declaration of `<invalid operator>

' with no type

SocketAddress.h:29: error: `<invalid operator>' declared as a `virtual' field

Socket.cpp: In member function `virtual void sockets::Socket::OnException()':

Socket.cpp:171: error: `socklen_t' undeclared (first use this function)

Socket.cpp:171: error: (Each undeclared identifier is reported only once for

each function it appears in.)

Socket.cpp:171: error: parse error before `=' token

Socket.cpp:175: error: `errlen' undeclared (first use this function)

Socket.cpp: In member function `virtual bool sockets::Socket::CheckConnect()':

Socket.cpp:195: error: parse error before `=' token

make: *** [Socket.o] Error 1

The project compiles in Windows XP without problems.

What I'm doing wrong? I'm newbye in Mac architecture.

I'll appreciate your help.

Salutations.

1a8c9e1f8b58ebf6f2adff5acbc3b515_thumb

Project Spotlight

vitetris

A text-based Tetris with network 2-player mode.

Ad9cbe36e08562fbc287a7f7fdac7b2b_thumb

Project Spotlight

SLiteChat

An in-world SL text-only local chat/instant messaging client.