private void Form1_Load(object sender, EventArgs e) { p2p.NATthroughevent += P2p_NATthroughevent; p2p.receiveevent += P2p_receiveevent; p2p.start(16680); timer1.Start(); }
static void Main(string[] args) { p2psever server = new p2psever(); server.receiveevent += Server_receiveevent; server.start(8989); Console.WriteLine("8989listen:"); Console.ReadKey(); }
public bool Run(MyInterface.MyInterface myI) { // Mycommand comm = new Mycommand(, connectionString); ReloadFlies(); p2psev = new p2psever(myI.Parameter[3]); p2psev.receiveevent += p2psev_receiveevent; p2psev.EventUpdataConnSoc += p2psev_EventUpdataConnSoc; p2psev.EventDeleteConnSoc += p2psev_EventDeleteConnSoc; // p2psev.NATthroughevent += tcp_NATthroughevent;//p2p事件,不需要使用 p2psev.start(Convert.ToInt32(myI.Parameter[4])); //myI.Parameter[4]是端口号 qt.Add("onlinetoken", onlines); //初始化一个队列,记录在线人员的token if (EventMylog != null) { EventMylog("连接", "连接启动成功"); } return(true); }
public bool Run(string loaclIP, int port, int port2) { // Mycommand comm = new Mycommand(, connectionString); ReLoad(); p2psev.receiveevent += p2psev_receiveevent; p2psev.EventUpdataConnSoc += p2psev_EventUpdataConnSoc; p2psev.EventDeleteConnSoc += p2psev_EventDeleteConnSoc; // p2psev.NATthroughevent += tcp_NATthroughevent;//p2p事件,不需要使用 p2psev.start(Convert.ToInt32(port)); p2psev2 = new p2psever(loaclIP); p2psev2.EventDeleteConnSoc += P2psev2_EventDeleteConnSoc; p2psev2.EventUpdataConnSoc += P2psev2_EventUpdataConnSoc; p2psev2.receiveevent += P2psev2_receiveevent; // p2psev.NATthroughevent += tcp_NATthroughevent;//p2p事件,不需要使用 p2psev2.start(Convert.ToInt32(port2)); if (EventMylog != null) { EventMylog("连接", "连接启动成功"); } return(true); }