diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-02-07 21:49:52 +0100 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-02-07 21:49:52 +0100 |
commit | b7d524423c23470cd11e720eeb48368c072838cb (patch) | |
tree | f1478e6d8e9dc68332f493595e1f9265c964e68c /source/cSocket.cpp | |
parent | cSocketThreads initial commit. Not yet tested and not yet integrated (diff) | |
download | cuberite-b7d524423c23470cd11e720eeb48368c072838cb.tar cuberite-b7d524423c23470cd11e720eeb48368c072838cb.tar.gz cuberite-b7d524423c23470cd11e720eeb48368c072838cb.tar.bz2 cuberite-b7d524423c23470cd11e720eeb48368c072838cb.tar.lz cuberite-b7d524423c23470cd11e720eeb48368c072838cb.tar.xz cuberite-b7d524423c23470cd11e720eeb48368c072838cb.tar.zst cuberite-b7d524423c23470cd11e720eeb48368c072838cb.zip |
Diffstat (limited to 'source/cSocket.cpp')
-rw-r--r-- | source/cSocket.cpp | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/source/cSocket.cpp b/source/cSocket.cpp index 90c31f58d..fa016762c 100644 --- a/source/cSocket.cpp +++ b/source/cSocket.cpp @@ -2,12 +2,11 @@ #include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cSocket.h"
+#include "packets/cPacket.h"
#ifndef _WIN32
#include <netdb.h>
#include <unistd.h>
- // #include <sys/socket.h>
- // #include <netinet/in.h>
#include <arpa/inet.h> //inet_ntoa()
#else
#define socklen_t int
@@ -273,6 +272,28 @@ int cSocket::Send(const char * a_Buffer, unsigned int a_Length) +int cSocket::Send(const cPacket * a_Packet)
+{
+ AString Serialized;
+ a_Packet->Serialize(Serialized);
+ return Send(Serialized.data(), Serialized.size());
+}
+
+
+
+
+
+int cSocket::Send(const cPacket & a_Packet)
+{
+ AString Serialized;
+ a_Packet.Serialize(Serialized);
+ return Send(Serialized.data(), Serialized.size());
+}
+
+
+
+
+
unsigned short cSocket::GetPort(void) const
{
assert(IsValid());
|