nuclear@0: /************************************************************************************ nuclear@0: nuclear@0: Filename : OVR_Socket.cpp nuclear@0: Content : Socket common data shared between all platforms. nuclear@0: Created : June 10, 2014 nuclear@0: Authors : Kevin Jenkins, Chris Taylor nuclear@0: nuclear@0: Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. nuclear@0: nuclear@0: Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); nuclear@0: you may not use the Oculus VR Rift SDK except in compliance with the License, nuclear@0: which is provided at the time of installation or download, or which nuclear@0: otherwise accompanies this software in either electronic or hard copy form. nuclear@0: nuclear@0: You may obtain a copy of the License at nuclear@0: nuclear@0: http://www.oculusvr.com/licenses/LICENSE-3.2 nuclear@0: nuclear@0: Unless required by applicable law or agreed to in writing, the Oculus VR SDK nuclear@0: distributed under the License is distributed on an "AS IS" BASIS, nuclear@0: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. nuclear@0: See the License for the specific language governing permissions and nuclear@0: limitations under the License. nuclear@0: nuclear@0: ************************************************************************************/ nuclear@0: nuclear@0: #include "OVR_Socket.h" nuclear@0: nuclear@0: namespace OVR { namespace Net { nuclear@0: nuclear@0: nuclear@0: //----------------------------------------------------------------------------- nuclear@0: // Socket nuclear@0: nuclear@0: Socket::Socket() : nuclear@0: Transport(TransportType_None) nuclear@0: { nuclear@0: } nuclear@0: nuclear@0: nuclear@0: //----------------------------------------------------------------------------- nuclear@0: // BerkleyBindParameters nuclear@0: nuclear@0: BerkleyBindParameters::BerkleyBindParameters() : nuclear@0: Port(0), nuclear@0: Address(), nuclear@0: blockingTimeout(0x7fffffff) nuclear@0: { nuclear@0: } nuclear@0: nuclear@0: //----------------------------------------------------------------------------- nuclear@0: // BerkleySocket nuclear@0: nuclear@0: BerkleySocket::BerkleySocket() : nuclear@0: TheSocket(INVALID_SOCKET) nuclear@0: //TimeoutUsec(0) // Initialized by SetBlockingTimeout nuclear@0: //TimeoutSec(0) // " nuclear@0: { nuclear@0: SetBlockingTimeout(1000); nuclear@0: } nuclear@0: nuclear@0: BerkleySocket::~BerkleySocket() nuclear@0: { nuclear@0: // Close socket on destruction nuclear@0: Close(); nuclear@0: } nuclear@0: nuclear@0: nuclear@0: //----------------------------------------------------------------------------- nuclear@0: // UDPSocketBase nuclear@0: nuclear@0: UDPSocketBase::UDPSocketBase() nuclear@0: { nuclear@0: Transport = TransportType_UDP; nuclear@0: } nuclear@0: nuclear@0: nuclear@0: //----------------------------------------------------------------------------- nuclear@0: // TCPSocketBase nuclear@0: nuclear@0: TCPSocketBase::TCPSocketBase() nuclear@0: : IsListenSocket(false) nuclear@0: { nuclear@0: Transport = TransportType_TCP; nuclear@0: } nuclear@0: nuclear@0: TCPSocketBase::TCPSocketBase(SocketHandle handle) nuclear@0: : IsListenSocket(false) nuclear@0: { nuclear@0: TheSocket = handle; nuclear@0: } nuclear@0: nuclear@0: nuclear@0: }} // OVR::Net