- 写下supersocket的使用方式
- 首先需要加入supersocket的dll文件SuperSocket.Common.dll、SuperSocket.Facility.dll、SuperSocket.SocketBase.dll、SuperSocket.SocketEngine.dll,SuperSocket.Facility.dll是接收过滤包,如果想用log4net还需要log4net.dll包
- 主要实现3个类 AppSession AppServer ReceiveFilterBase 这三个类,
AppSession是每个socket连接
AppServer是服务
ReceiveFilterBase是接收到的数据过滤
namespace TestSuperSocket
{
public class WzAppServer : AppServer<WzAppSession, BinaryRequestInfo>
{
public WzAppServer()
: base(new DefaultReceiveFilterFactory<TestMyFilter, BinaryRequestInfo>())
{
//DefaultResponse = new byte[] { 0x54, 0x68, 0x1a, 0x0d, 0x0a };
}
//internal byte[] DefaultResponse { get; private set; }
}
}
namespace TestSuperSocket
{
public class WzAppSession :AppSession<WzAppSession, BinaryRequestInfo>
{
public new WzAppServer AppServer
{
get
{
return (WzAppServer)base.AppServer;