mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-14 05:47:14 +02:00
rxr sls namespace (#457)
* rxr src files and classes (detectordata, ZmqSocket) added to sls namespace * moving defines inside namespace * moving defines inside namespace, added helpdacs to namespace * added namespace to gui * gui also updated * removed unnecessary sls:: when already in sls namespace for slsDetectoSoftware, receverSoftware, slsDetectorGui and slsSupportlib
This commit is contained in:
@ -14,12 +14,14 @@
|
||||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
namespace sls {
|
||||
|
||||
#define DEFAULT_PACKET_SIZE 1286
|
||||
#define SOCKET_BUFFER_SIZE (100 * 1024 * 1024) // 100 MB
|
||||
#define DEFAULT_BACKLOG 5
|
||||
|
||||
namespace sls {
|
||||
|
||||
ServerSocket::ServerSocket(int port)
|
||||
: DataSocket(socket(AF_INET, SOCK_STREAM, 0)), serverPort(port) {
|
||||
|
||||
@ -31,7 +33,7 @@ ServerSocket::ServerSocket(int port)
|
||||
if (bind(getSocketId(), (struct sockaddr *)&serverAddr,
|
||||
sizeof(serverAddr)) != 0) {
|
||||
close();
|
||||
throw sls::SocketError(
|
||||
throw SocketError(
|
||||
std::string("Server ERROR: cannot bind socket with port number ") +
|
||||
std::to_string(port) +
|
||||
std::string(". Please check if another instance is running."));
|
||||
@ -49,7 +51,7 @@ ServerInterface ServerSocket::accept() {
|
||||
int newSocket =
|
||||
::accept(getSocketId(), (struct sockaddr *)&clientAddr, &addr_size);
|
||||
if (newSocket == -1) {
|
||||
throw sls::SocketError("Server ERROR: socket accept failed\n");
|
||||
throw SocketError("Server ERROR: socket accept failed\n");
|
||||
}
|
||||
char tc[INET_ADDRSTRLEN]{};
|
||||
inet_ntop(AF_INET, &(clientAddr.sin_addr), tc, INET_ADDRSTRLEN);
|
||||
|
Reference in New Issue
Block a user