[DEV] start port of windows socket
This commit is contained in:
parent
739f70020b
commit
1571338fde
@ -7,14 +7,17 @@
|
||||
#include <enet/debug.h>
|
||||
#include <enet/Tcp.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <etk/stdTools.h>
|
||||
|
||||
#ifndef __TARGET_OS__Windows
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/tcp.h>
|
||||
#endif
|
||||
|
||||
bool enet::Tcp::setTCPNoDelay(bool _enabled) {
|
||||
if (m_socketId >= 0) {
|
||||
|
@ -6,14 +6,18 @@
|
||||
#pragma once
|
||||
|
||||
#include <etk/types.h>
|
||||
#include <poll.h>
|
||||
#include <mutex>
|
||||
#ifndef __TARGET_OS__Windows
|
||||
#include <poll.h>
|
||||
#endif
|
||||
|
||||
namespace enet {
|
||||
class Tcp {
|
||||
private:
|
||||
int32_t m_socketId; //!< socket linux interface generic
|
||||
#ifndef __TARGET_OS__Windows
|
||||
struct pollfd m_fds[1];
|
||||
#endif
|
||||
std::mutex m_mutex;
|
||||
public:
|
||||
Tcp();
|
||||
|
@ -8,13 +8,13 @@
|
||||
#include <enet/Tcp.h>
|
||||
#include <enet/TcpClient.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <etk/stdTools.h>
|
||||
|
||||
#include <sys/socket.h>
|
||||
|
||||
enet::Tcp enet::connectTcpClient(uint8_t _ip1, uint8_t _ip2, uint8_t _ip3, uint8_t _ip4, uint16_t _port, uint32_t _numberRetry) {
|
||||
|
@ -8,14 +8,20 @@
|
||||
#include <enet/Tcp.h>
|
||||
#include <enet/TcpServer.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <etk/stdTools.h>
|
||||
|
||||
#ifdef __TARGET_OS__Windows
|
||||
#include <winsock2.h>
|
||||
//https://msdn.microsoft.com/fr-fr/library/windows/desktop/ms737889(v=vs.85).aspx
|
||||
#else
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
|
||||
enet::TcpServer::TcpServer() :
|
||||
m_socketId(-1),
|
||||
|
@ -4,15 +4,18 @@
|
||||
* @license APACHE v2.0 (see license file)
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <poll.h>
|
||||
#include <enet/Tcp.h>
|
||||
#ifdef __TARGET_OS__Windows
|
||||
|
||||
#else
|
||||
#include <poll.h>
|
||||
#endif
|
||||
|
||||
namespace enet {
|
||||
class TcpServer {
|
||||
private:
|
||||
int32_t m_socketId; //!< socket linux interface generic
|
||||
#if 1
|
||||
#ifndef __TARGET_OS__Windows
|
||||
struct pollfd m_fds[1];
|
||||
#endif
|
||||
public:
|
||||
|
@ -31,13 +31,9 @@ def create(target, module_name):
|
||||
'ememory',
|
||||
'algue'
|
||||
])
|
||||
my_module.add_src_file([
|
||||
'enet/debug.cpp'
|
||||
])
|
||||
my_module.add_path(tools.get_current_path(__file__))
|
||||
if "Windows" in target.get_type():
|
||||
return my_module
|
||||
my_module.add_src_file([
|
||||
'enet/debug.cpp',
|
||||
'enet/Udp.cpp',
|
||||
'enet/Tcp.cpp',
|
||||
'enet/TcpServer.cpp',
|
||||
|
Loading…
x
Reference in New Issue
Block a user