repositories
/
deb_libcec.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
posix: fixed lib/platform/sockets/tcp.h compilation and some bugs. added CTcpSocket...
[deb_libcec.git]
/
src
/
lib
/
platform
/
posix
/
os-tcp.h
diff --git
a/src/lib/platform/posix/os-tcp.h
b/src/lib/platform/posix/os-tcp.h
index df4a2a983090a26953c96c5f61279a5cbbb77be0..86d0603916e6357250b8f0ae42c48b80673711a4 100644
(file)
--- a/
src/lib/platform/posix/os-tcp.h
+++ b/
src/lib/platform/posix/os-tcp.h
@@
-2,7
+2,7
@@
/*
* This file is part of the libCEC(R) library.
*
/*
* This file is part of the libCEC(R) library.
*
- * libCEC(R) is Copyright (C) 2011 Pulse-Eight Limited. All rights reserved.
+ * libCEC(R) is Copyright (C) 2011
-2012
Pulse-Eight Limited. All rights reserved.
* libCEC(R) is an original work, containing original code.
*
* libCEC(R) is a trademark of Pulse-Eight Limited.
* libCEC(R) is an original work, containing original code.
*
* libCEC(R) is a trademark of Pulse-Eight Limited.
@@
-34,8
+34,20
@@
#include "../os.h"
#include "../sockets/socket.h"
#include "../os.h"
#include "../sockets/socket.h"
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+#include <poll.h>
+
namespace PLATFORM
{
namespace PLATFORM
{
+ inline void TcpShutdownSocket(socket_t socket)
+ {
+ shutdown(socket, SHUT_RDWR);
+ }
+
inline int TcpGetSocketError(socket_t socket)
{
int iReturn(0);
inline int TcpGetSocketError(socket_t socket)
{
int iReturn(0);
@@
-67,13
+79,17
@@
namespace PLATFORM
else if (iPollResult == -1)
*iError = errno;
else
else if (iPollResult == -1)
*iError = errno;
else
- *iError = TcpGetSocketError(socket);
+ bConnected = true;
+ }
+ else
+ {
+ *iError = errno;
}
return bConnected;
}
}
return bConnected;
}
- inline bool TcpResolveAddress(const char *strHost, uint16_t iPort, int *iError, struct addrinfo *info)
+ inline bool TcpResolveAddress(const char *strHost, uint16_t iPort, int *iError, struct addrinfo *
*
info)
{
struct addrinfo hints;
char service[33];
{
struct addrinfo hints;
char service[33];
@@
-83,6
+99,7
@@
namespace PLATFORM
hints.ai_protocol = IPPROTO_TCP;
sprintf(service, "%d", iPort);
hints.ai_protocol = IPPROTO_TCP;
sprintf(service, "%d", iPort);
- return ((*iError = getaddrinfo(strHost, service, &hints, &info)) == 0);
+ *iError = getaddrinfo(strHost, service, &hints, info);
+ return !(*iError);
}
}
}
}