Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #ifndef __SP_NETWORK_BASE_UDP_H__
00009 #define __SP_NETWORK_BASE_UDP_H__
00010
00011
00012 #include "Base/spStandard.hpp"
00013
00014 #ifdef SP_COMPILE_WITH_NETWORKSYSTEM
00015
00016
00017 #include "Framework/Network/spNetworkCore.hpp"
00018 #include "Framework/Network/spNetworkBase.hpp"
00019 #include "Base/spThreadManager.hpp"
00020
00021 struct sockaddr_in;
00022
00023
00024 namespace sp
00025 {
00026 namespace network
00027 {
00028
00029
00030 class NetworkPacket;
00031 class NetworkSocket;
00032
00034 class SP_EXPORT NetworkBaseUDP : public NetworkBase
00035 {
00036
00037 public:
00038
00039 virtual ~NetworkBaseUDP();
00040
00041 protected:
00042
00043 friend THREAD_PROC(NetworkSessionReceptionThread);
00044
00045
00046
00047 static const u32 RECVBUFFER_SIZE = 4096;
00048
00049
00050
00051 NetworkBaseUDP();
00052
00053 bool bindSocketToPort(u16 Port);
00054
00055 s32 sendPacketToAddress(const NetworkPacket &Packet, const sockaddr_in &Address);
00056 bool receivePacketFromAddress(NetworkPacket &Packet, sockaddr_in &Address);
00057
00058 static s32 sendPacketToAddress(
00059 SOCKET Socket, const NetworkPacket &Packet, const sockaddr_in &Address
00060 );
00061 static bool receivePacketFromAddress(
00062 SOCKET Socket, NetworkPacket &Packet, sockaddr_in &Address,
00063 c8* RecvBuffer, u32 RecvBufferSize
00064 );
00065
00066
00067
00068 static c8 RecvBuffer_[RECVBUFFER_SIZE];
00069
00070 };
00071
00072
00073 }
00074
00075 }
00076
00077
00078 #endif
00079
00080 #endif
00081
00082
00083
00084