本文整理汇总了C#中SocketState.GetEdge方法的典型用法代码示例。如果您正苦于以下问题:C# SocketState.GetEdge方法的具体用法?C# SocketState.GetEdge怎么用?C# SocketState.GetEdge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SocketState
的用法示例。
在下文中一共展示了SocketState.GetEdge方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleWrites
protected void HandleWrites(SocketState ss) {
ArrayList socks = ss.WriteSocks;
for(int i = 0; i < socks.Count; i++) {
Socket s = (Socket)socks[i];
CreationState cs = ss.TakeCreationState( s );
if( cs != null ) {
cs.HandleWritability(s);
}
else {
//Let's try to flush the buffer:
try {
ss.FlushSocket(s);
}
catch {
/*
* We should close this edge
*/
TcpEdge tcpe = ss.GetEdge(s);
TEL.RequestClose(tcpe);
//Go ahead and forget about this socket.
CloseAction ca = new CloseAction(tcpe, null);
ca.Start(ss);
}
}
}
}
示例2: Start
public override void Start(SocketState ss) {
/*
* Note, we are the only thread running actions from the queue,
* so, no change to ss can happen concurrently with this logic
*/
ArrayList close_actions = new ArrayList();
foreach(Socket s in ss.AllSockets) {
TcpEdge e = ss.GetEdge(s);
TEL.RequestClose(e);
/*
* We can't just call ca.Start(ss) because that
* would change ss.AllSockets
*/
close_actions.Add(new CloseAction(e, null));
}
foreach(CloseAction ca in close_actions) {
ca.Start(ss);
}
//Close the main socket:
ss.ListenSock.Close();
}