public void SendProtobufCmd(int serviceType, int cmdType, ProtoBuf.IExtensible body = null) { var cmdPackage = CmdPackageProtocol.PackageProtobuf(serviceType, cmdType, body); if (cmdPackage == null) { return; } var tcpPackage = TcpProtocol.Pack(cmdPackage); if (tcpPackage == null) { return; } try { this.clientSocket.BeginSend( tcpPackage, 0, tcpPackage.Length, SocketFlags.None, OnAfterSend, this.clientSocket); } catch (Exception e) { OnConnectError(e); } }
public void UdpSendProtobufCmd(int serviceType, int cmdType, ProtoBuf.IExtensible body = null) { var cmdPackage = CmdPackageProtocol.PackageProtobuf(serviceType, cmdType, body); if (cmdPackage == null) { return; } try { this.udpSocket.BeginSendTo( cmdPackage, 0, cmdPackage.Length, SocketFlags.None, this.udpRemotePoint, OnUdpSend, this.udpSocket); } catch (Exception e) { OnError(e); } }