本文整理汇总了C#中SC.GetName方法的典型用法代码示例。如果您正苦于以下问题:C# SC.GetName方法的具体用法?C# SC.GetName怎么用?C# SC.GetName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SC
的用法示例。
在下文中一共展示了SC.GetName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AttachServer
public override void AttachServer(SC.Interfaces.IPluginServer server)
{
base.AttachServer(server);
System.Net.Sockets.SocketType sockType;
System.Net.Sockets.ProtocolType protoType;
if (server.Protocol == System.Net.TransportType.Tcp || server.Protocol == System.Net.TransportType.ConnectionOriented)
{
sockType = System.Net.Sockets.SocketType.Stream;
protoType = System.Net.Sockets.ProtocolType.Tcp;
}
else if (server.Protocol == System.Net.TransportType.Udp || server.Protocol == System.Net.TransportType.Connectionless)
{
sockType = System.Net.Sockets.SocketType.Dgram;
protoType = System.Net.Sockets.ProtocolType.Udp;
}
else
throw new ArgumentException("Invalid protocol specified");
socket = new System.Net.Sockets.Socket(System.Net.Sockets.AddressFamily.InterNetwork, sockType, protoType);
socket.Blocking = false;
socket.DontFragment = false;
socket.EnableBroadcast = false;
if (protoType == System.Net.Sockets.ProtocolType.Tcp)
{
socket.LingerState.Enabled = false;
socket.LingerState.LingerTime = 0;
socket.NoDelay = true;
}
socket.UseOnlyOverlappedIO = false;
socket.Connect(server.EndPoint);
Logger.Info("Attached to server " + server.GetName());
}