📄 gsocketbase.cs
字号:
using System;
using System.Net;
using System.Net.Sockets;
namespace gowk.net.Sockets
{
/// <summary>
/// IGSocket 的摘要说明。
/// </summary>
public abstract class GSocketBase:ISocket
{
protected Socket OwnerSock;
private Proxy m_Proxy;
public virtual int Send(byte[] buffer)
{
return this.OwnerSock.Send(buffer);
}
public virtual int SendTo(byte[] buffer, EndPoint remoteEP)
{
return this.OwnerSock.SendTo(buffer,remoteEP);
}
public virtual int Receive(byte[] buffer)
{
return this.OwnerSock.Receive(buffer);
}
public virtual int ReceiveFrom(byte[] buffer, ref EndPoint remoteEP)
{
return this.OwnerSock.ReceiveFrom(buffer,ref remoteEP);
}
public virtual void Close()
{
this.OwnerSock.Close();
}
public abstract void Connect(string host,int port);
public virtual object GetSocketOption(SocketOptionLevel optionLevel, SocketOptionName optionName)
{
return this.OwnerSock.GetSocketOption(optionLevel,optionName);
}
public virtual void SetSocketOption(SocketOptionLevel optionLevel, SocketOptionName optionName, int optionValue)
{
this.OwnerSock.SetSocketOption(optionLevel,optionName,optionValue);
}
public virtual void Bind(EndPoint ep)
{
this.OwnerSock.Bind(ep);
}
public virtual Proxy Proxy
{
get{return m_Proxy;}
set{this.m_Proxy=value;}
}
public virtual void LoginProxy()
{
}
public virtual void Negotiation(string host,int port)
{
}
public void AsyncInvoke(AsyncCallback callback)
{
callback.BeginInvoke(null,null,null);
}
public virtual System.IO.Stream GetStream()
{
return new NetworkStream(this.OwnerSock);
}
public virtual bool Connected
{
get{return (this.OwnerSock!=null)&&this.OwnerSock.Connected;}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -