Projects / C++ Sockets / Comments

Comments for C++ Sockets

04 Aug 2011 05:04 Hirogens

Hi,

I can't compile.
under Seven 64Bits/ Cygwin lastest, no support windows.
(I can compile big lib, Boost, Mysql, Apache etc)
normally no problem on my installation.

I have this error. (Compiler GCC 4.3.4)
compile with "linux-x86-32"

g++ -Wall -g -I/usr/include/libxml2 -MD -D_VERSION='"2.3.9.6"' -O2 -DLINUX -c -o Socket.o Socket.cpp
Socket.cpp: In member function 'bool Socket::IpAddMembership(ip_mreqn&)':
Socket.cpp:1248: error: invalid application of 'sizeof' to incomplete type 'ip_mreqn'
Socket.cpp: In member function 'bool Socket::IpDropMembership(ip_mreqn&)':
Socket.cpp:1282: error: invalid application of 'sizeof' to incomplete type 'ip_mreqn'
make: *** [Socket.o] Error 1

B.Regards

08 Jun 2011 21:53 DerekMcGowan

Why not use a public svn/git repository?

07 Oct 2010 21:41 wurzelfm

The following patch allows it to build with DETACH and RECONNECT unconfigured.

diff --git a/SocketHandler.cpp b/SocketHandler.cpp
--- a/SocketHandler.cpp
+++ b/SocketHandler.cpp
@@ -1001,6 +1001,7 @@
void SocketHandler::CheckDetach()
{
m_b_check_detach = false;
+#ifdef ENABLE_DETACH
for (socket_m::iterator it = m_sockets.begin(); it != m_sockets.end(); it++)
{
Socket *p = it -> second;
@@ -1016,6 +1017,7 @@
m_b_check_detach = true;
}
}
+#endif
}


@@ -1086,8 +1088,11 @@
if (p -> CloseAndDelete() )
{
TcpSocket *tcp = dynamic_cast<TcpSocket *>(p);
- if (p -> Lost() && !(tcp && tcp -> Reconnect()))
- {
+ if (p -> Lost()
+#ifdef ENABLE_RECONNECT
+ && !(tcp && tcp -> Reconnect())
+#endif
+ ) {
// remove instance when Lost, if not reconnect flag is set
DeleteSocket(p);
}

07 Oct 2010 18:56 wurzelfm

Disabling DETACH or RECONNECT breaks the build in v2.3.9.3:
I turned off both of these in my config-sockets.h file and when I make:

mipsisa32-xlr-linux-g++ -Wall -g -I/usr/include/libxml2 -MD -D_VERSION='"2.3.9.3"' -O2 -DLINUX -fPIC -c -o SocketHandler.o SocketHandler.cpp
SocketHandler.cpp: In member function `void SocketHandler::CheckDetach()':
SocketHandler.cpp:1007: error: 'class Socket' has no member named 'IsDetach'
SocketHandler.cpp:1012: error: 'class Socket' has no member named 'DetachSocket'
SocketHandler.cpp: In member function `void SocketHandler::CheckClose()':
SocketHandler.cpp:1089: error: 'class TcpSocket' has no member named 'Reconnect'
make[1]: *** [SocketHandler.o] Error 1

16 Jun 2010 09:34 e1212dison

I use this library in my assignment. It is a chatting program, C++ Sockets as low level, QT as GUI, works well.

Just curious how robust is this lib.
I have found another similar library Boost:asio.
What's the advantage and disadvantage of this C++ Sockets.

03 Jun 2010 13:04 gewala

A problem of Version 2.3.9.2 in window xp2

I find the SocketHandler class in an infinite loop with error when the socket disconnect.
so i debug it and find the problem is not delete the exception fd_set(m_efds) when socket disconnect.

//SocketHandler.cpp -- 245:
void SocketHandler::Set(Socket *p,bool bRead,bool bWrite)
{
SOCKET s = p -> GetSocket();
if (s >= 0)
{
bool bException = true;
.......
if (bException)
{
if (!FD_ISSET(s, &m_efds))
{
FD_SET(s, &m_efds);
}
}
Why don't clear exception fd_set?

13 Apr 2010 15:12 WeberGer

Version 2.3.9.2 does not compile in Visual C + + 6.0.!!!!!
-----------------------------------------------------------------------------
I find errors like the following:
c: \ provir_cc \ sockets-2.3.9.2 \ socket_include.cpp (88): error C2065: 'sprintf_s': undeclared identifier
c: \ provir_cc \ sockets-2.3.9.2 \ utility.cpp (207): error C2065: 'sprintf_s': undeclared identifier
c: \ provir_cc \ sockets-2.3.9.2 \ utility.cpp (573): error C2065: 'getenv_s': undeclared identifier
...
...
Sockets.lib - 30 error (s), 4 warning (s)

Visual C + + does not support sprintf_s function

Which version supports Visual C + + 6?

11 Sep 2008 16:14 amclellan

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?

>

>

09 Sep 2008 16:41 amclellan

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?

30 May 2007 10:45 dilogsys

Compilation error
...

g++ -Wall -g -MD -D_VERSION='&quot;2.1.6&quot;' -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

Screenshot

Project Spotlight

ReciJournal

An open, cross-platform journaling program.

Screenshot

Project Spotlight

Veusz

A scientific plotting package.