static public SocketHelper GetInstance() { if (instance_ == null) { instance_ = new SocketHelper(); } return(instance_); }
private void InitSocket() { this.udpRemote_ = new IPEndPoint(IPAddress.Broadcast, REMOTE_PORT); IPEndPoint ip = new IPEndPoint(IPAddress.Any, BIND_PORT); this.udp_ = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); this.udp_.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, 1); try { this.udp_.Bind(ip); SocketHelper.GetInstance().Register(this); } catch (SocketException e) { } }
public ISocket() { SocketHelper.GetInstance().recvHandle_ += new SocketHelper.RecvSignalHandle(RecvSignaled); }