C++ Sockets Library documentation

C++ Sockets Library

Name of changed file

Version and , fileVersion and , file
Line 1 in Line 1 in
Context line
Removed line
Changed line
Context line
Context line
Changed line
Added line
Context line

Changelog

/usr/src/Sockets-2.3.9.6/Changelog 2011-07-25 23:55:36.0, 0200/usr/src/Sockets-2.3.9.7/Changelog 2011-08-16 19:32:09.0, 0200
Line 1 in ChangelogLine 1 in Changelog
diff for next release always available @ http://www.alhem.net/Sockets/latest_diff.html
2.3.9.7
--------
Faster detach, now also works from OnAccept.
Reclaim memory when using pthread attributes.
A detach thread now exits normally.
2.3.9.6
--------
Line 10 in ChangelogLine 16 in Changelog
port number in udpsocket after call to Bind method. Preserve m_b_check*
flags in sockethandler during add phase. Timing problem during detach
process fixed.
2.3.9.5
port number in udpsocket after call to Bind method. Preserve m_b_check*
flags in sockethandler during add phase. Timing problem during detach
process fixed. Added more options to Sockets-config executable, it can now
be used to directly modify Makefile and sockets-config.h.
2.3.9.5

Debug.cpp

/usr/src/Sockets-2.3.9.6/Debug.cpp 2010-07-14 13:40:49.0, 0200/usr/src/Sockets-2.3.9.7/Debug.cpp 2011-08-16 17:02:30.0, 0200
Line 1 in Debug.cppLine 1 in Debug.cpp
/**
** \file Debug.cpp
** \date 2011-08-16
** \author grymse@alhem.net
**/
/*
Copyright (C) 2011 Anders Hedstrom
This library is made available under the terms of the GNU GPL.
If you would like to use this library in a closed-source application,
a separate license agreement is available. For information about
the closed-source license agreement for the C++ sockets library,
please visit http://www.alhem.net/Sockets/license.html and/or
email license@alhem.net.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "Debug.h"
#include <stdarg.h>

Debug.h

/usr/src/Sockets-2.3.9.6/Debug.h 2010-02-06 20:01:12.0, 0100/usr/src/Sockets-2.3.9.7/Debug.h 2011-08-16 17:02:01.0, 0200
Line 1 in Debug.hLine 1 in Debug.h
/**
** \file Debug.h
** \date 2011-08-16
** \author grymse@alhem.net
**/
/*
Copyright (C) 2011 Anders Hedstrom
This library is made available under the terms of the GNU GPL.
If you would like to use this library in a closed-source application,
a separate license agreement is available. For information about
the closed-source license agreement for the C++ sockets library,
please visit http://www.alhem.net/Sockets/license.html and/or
email license@alhem.net.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _SOCKETS_Debug_H
#define _SOCKETS_Debug_H

Json.cpp

/usr/src/Sockets-2.3.9.6/Json.cpp 2011-07-05 12:58:35.0, 0200/usr/src/Sockets-2.3.9.7/Json.cpp 2011-08-16 17:03:36.0, 0200
Line 1 in Json.cppLine 1 in Json.cpp
/**
** \file Json.cpp
** \date 2011-08-16
** \author grymse@alhem.net
**/
/*
Copyright (C) 2011 Anders Hedstrom
This library is made available under the terms of the GNU GPL.
If you would like to use this library in a closed-source application,
a separate license agreement is available. For information about
the closed-source license agreement for the C++ sockets library,
please visit http://www.alhem.net/Sockets/license.html and/or
email license@alhem.net.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "Json.h"
#include <sstream>

Json.h

/usr/src/Sockets-2.3.9.6/Json.h 2011-07-05 12:58:29.0, 0200/usr/src/Sockets-2.3.9.7/Json.h 2011-08-16 17:03:31.0, 0200
Line 1 in Json.hLine 1 in Json.h
/**
** \file Json.h
** \date 2011-08-16
** \author grymse@alhem.net
**/
/*
Copyright (C) 2011 Anders Hedstrom
This library is made available under the terms of the GNU GPL.
If you would like to use this library in a closed-source application,
a separate license agreement is available. For information about
the closed-source license agreement for the C++ sockets library,
please visit http://www.alhem.net/Sockets/license.html and/or
email license@alhem.net.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _SOCKETS_Json_H
#define _SOCKETS_Json_H

Makefile.version

/usr/src/Sockets-2.3.9.6/Makefile.version 2011-07-25 23:55:50.0, 0200/usr/src/Sockets-2.3.9.7/Makefile.version 2011-08-16 12:06:18.0, 0200
Line 1 in Makefile.versionLine 1 in Makefile.version
MAJOR = 2
MINOR = 3.9.6
VERSION = $(MAJOR).$(MINOR)
DIFF_VERSION = 2.3.9.5
# Sockets
MAJOR = 2
MINOR = 3.9.7
VERSION = $(MAJOR).$(MINOR)
DIFF_VERSION = 2.3.9.6
# Sockets

SocketHandler.cpp

/usr/src/Sockets-2.3.9.6/SocketHandler.cpp 2011-07-24 00:12:39.0, 0200/usr/src/Sockets-2.3.9.7/SocketHandler.cpp 2011-08-16 12:12:12.0, 0200
Line 1046 in SocketHandler.cppLine 1046 in SocketHandler.cpp
}
}
for (std::list<Socket *>::iterator it = m_add.begin(); it != m_add.end() && !m_b_check_detach; ++it)
{
Socket *p = *it;
m_b_check_detach |= p -> IsDetach();
}
}
#endif
Line 1364 in SocketHandler.cppLine 1369 in SocketHandler.cpp
m_b_check_close)
{
return Select(0, 200000);
}
return Select(NULL);
m_b_check_close)
{
return Select(0, m_b_check_detach ? 10000 : 200000);
}
return Select(NULL);

SocketThread.cpp

/usr/src/Sockets-2.3.9.6/SocketThread.cpp 2011-01-22 08:43:50.0, 0100/usr/src/Sockets-2.3.9.7/SocketThread.cpp 2011-08-16 17:02:52.0, 0200
Line 1 in SocketThread.cppLine 1 in SocketThread.cpp
/**
** \file SocketThread.cpp
** \date 2011-08-16
** \author grymse@alhem.net
**/
/*
Copyright (C) 2011 Anders Hedstrom
This library is made available under the terms of the GNU GPL.
If you would like to use this library in a closed-source application,
a separate license agreement is available. For information about
the closed-source license agreement for the C++ sockets library,
please visit http://www.alhem.net/Sockets/license.html and/or
email license@alhem.net.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "SocketThread.h"
Line 35 in SocketThread.cppLine 65 in SocketThread.cpp
m_socket -> OnDetached();
m_h.EnableRelease();
while (m_h.GetCount() && IsRunning())
{
m_h.Select(0, 500000);
}
// m_socket now deleted oops
// yeah oops m_socket delete its socket thread, that means this
// so Socket will no longer delete its socket thread, instead we do this:
m_socket -> OnDetached();
m_h.EnableRelease();
while (m_h.GetCount() > 1 && IsRunning())
{
m_h.Select(0, 500000);
}
// m_socket now deleted oops
// (a socket can only be detached if DeleteByHandler() is true)
// yeah oops m_socket delete its socket thread, that means this
// so Socket will no longer delete its socket thread, instead we do this:

SocketThread.h

/usr/src/Sockets-2.3.9.6/SocketThread.h 2011-01-22 08:43:40.0, 0100/usr/src/Sockets-2.3.9.7/SocketThread.h 2011-08-16 17:02:42.0, 0200
Line 1 in SocketThread.hLine 1 in SocketThread.h
/**
** \file SocketThread.h
** \date 2011-08-16
** \author grymse@alhem.net
**/
/*
Copyright (C) 2011 Anders Hedstrom
This library is made available under the terms of the GNU GPL.
If you would like to use this library in a closed-source application,
a separate license agreement is available. For information about
the closed-source license agreement for the C++ sockets library,
please visit http://www.alhem.net/Sockets/license.html and/or
email license@alhem.net.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _SOCKETTHREAD_H
#define _SOCKETTHREAD_H

Thread.cpp

/usr/src/Sockets-2.3.9.6/Thread.cpp 2011-07-17 10:07:00.0, 0200/usr/src/Sockets-2.3.9.7/Thread.cpp 2011-08-16 12:16:06.0, 0200
Line 58 in Thread.cppLine 58 in Thread.cpp
m_thread = (HANDLE)_beginthreadex(NULL, 0, &StartThread, this, 0, &m_dwThreadId);
#else
pthread_attr_t attr;
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr,PTHREAD_CREATE_DETACHED);
if (pthread_create(&m_thread,&attr, StartThread,this) == -1)
{
perror("Thread: create failed");
SetRunning(false);
}
// pthread_attr_destroy(&attr);
#endif
m_release = release;
m_thread = (HANDLE)_beginthreadex(NULL, 0, &StartThread, this, 0, &m_dwThreadId);
#else
pthread_attr_init(&m_attr);
pthread_attr_setdetachstate(&m_attr,PTHREAD_CREATE_DETACHED);
if (pthread_create(&m_thread,&m_attr, StartThread,this) == -1)
{
perror("Thread: create failed");
SetRunning(false);
}
#endif
m_release = release;
Line 91 in Thread.cppLine 88 in Thread.cpp
if (m_thread)
::CloseHandle(m_thread);
#else
pthread_attr_destroy(&m_attr);
#endif
}

Thread.h

/usr/src/Sockets-2.3.9.6/Thread.h 2011-07-17 10:04:35.0, 0200/usr/src/Sockets-2.3.9.7/Thread.h 2011-08-16 12:14:51.0, 0200
Line 108 in Thread.hLine 108 in Thread.h
#else
pthread_t m_thread;
pthread_attr_t m_attr;
#endif
Page, code, and content Copyright (C) 2013 by Anders Hedström