summaryrefslogtreecommitdiffstats
path: root/source/OSSupport/Socket.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-03-04 19:40:48 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-03-04 19:40:48 +0100
commiteb68b7ce0157fd55b7d50cca956986d0fdb60bd1 (patch)
treec0aa246374d5dcb034b4652ea937fc0a5478c67b /source/OSSupport/Socket.cpp
parentPlayer can sit in minecarts (but not move them yet) (diff)
downloadcuberite-eb68b7ce0157fd55b7d50cca956986d0fdb60bd1.tar
cuberite-eb68b7ce0157fd55b7d50cca956986d0fdb60bd1.tar.gz
cuberite-eb68b7ce0157fd55b7d50cca956986d0fdb60bd1.tar.bz2
cuberite-eb68b7ce0157fd55b7d50cca956986d0fdb60bd1.tar.lz
cuberite-eb68b7ce0157fd55b7d50cca956986d0fdb60bd1.tar.xz
cuberite-eb68b7ce0157fd55b7d50cca956986d0fdb60bd1.tar.zst
cuberite-eb68b7ce0157fd55b7d50cca956986d0fdb60bd1.zip
Diffstat (limited to '')
-rw-r--r--source/OSSupport/Socket.cpp24
1 files changed, 20 insertions, 4 deletions
diff --git a/source/OSSupport/Socket.cpp b/source/OSSupport/Socket.cpp
index cad120fbe..e0cecc0e3 100644
--- a/source/OSSupport/Socket.cpp
+++ b/source/OSSupport/Socket.cpp
@@ -207,14 +207,30 @@ unsigned long cSocket::INTERNET_ADDRESS_LOCALHOST(void)
-int cSocket::Bind(SockAddr_In& a_Address)
+int cSocket::BindToAny(unsigned short a_Port)
{
sockaddr_in local;
memset(&local, 0, sizeof(local));
- local.sin_family = a_Address.Family;
- local.sin_addr.s_addr = a_Address.Address;
- local.sin_port = htons((u_short)a_Address.Port);
+ local.sin_family = AF_INET;
+ local.sin_addr.s_addr = 0;
+ local.sin_port = htons((u_short)a_Port);
+
+ return bind(m_Socket, (sockaddr*)&local, sizeof(local));
+}
+
+
+
+
+
+int cSocket::BindToLocalhost(unsigned short a_Port)
+{
+ sockaddr_in local;
+ memset(&local, 0, sizeof(local));
+
+ local.sin_family = AF_INET;;
+ local.sin_addr.s_addr = INTERNET_ADDRESS_LOCALHOST();
+ local.sin_port = htons((u_short)a_Port);
return bind(m_Socket, (sockaddr*)&local, sizeof(local));
}