This is what CoPackets uses to get/send the packets while loaded in conquer.
[Only registered and activated users can see links. Click Here To Register...]
So CXLoader loads up CoPackets and then calls "CX_Startup" passing the 2 functions that you call to send and receive packets. It then looks for functions names "CX_Send" and "CX_Recv" and calls those when packets are sent and received.
This is what the main part of CoPackets looks like.
So to get the packets sent and received you do
And to send packets packets to the client you do
[Only registered and activated users can see links. Click Here To Register...]
So CXLoader loads up CoPackets and then calls "CX_Startup" passing the 2 functions that you call to send and receive packets. It then looks for functions names "CX_Send" and "CX_Recv" and calls those when packets are sent and received.
This is what the main part of CoPackets looks like.
Code:
public class SendRecvClass
{
static SendRecvClass self;
public static SendRecvClass Self
{
get
{
if (self == null)
self = new SendRecvClass();
return self;
}
}
public MulticastDelegate SendFunc;
public MulticastDelegate RecvFunc;
public void Send(byte[] b)
{
SendFunc.DynamicInvoke(b);
}
public void Recv(byte[] b)
{
RecvFunc.DynamicInvoke(b);
}
public static void CX_Send(byte[] b)
{
bool block = false;
if (Self.OnSend != null)
Self.OnSend(b, ref block);
if (!block)
Self.Send(b);
}
public static void CX_Recv(byte[] b)
{
bool block = false;
if (Self.OnRecv != null)
Self.OnRecv(b, ref block);
if (!block)
Self.Recv(b);
}
public delegate void OnSendD(byte[] b, ref bool block);
public event OnSendD OnSend;
public delegate void OnRecvD(byte[] b, ref bool block);
public event OnRecvD OnRecv;
}
public class Startup
{
public static void Start()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
public static void CX_Startup(Object ps1, Object ps2)
{
SendRecvClass.Self.SendFunc = (MulticastDelegate)ps1;
SendRecvClass.Self.RecvFunc = (MulticastDelegate)ps2;
Thread t = new Thread(new ThreadStart(Start));
t.Start();
}
}
Code:
SendRecvClass.Self.OnSend += new SendRecvClass.OnSendD(Self_OnSend); SendRecvClass.Self.OnRecv += new SendRecvClass.OnRecvD(Self_OnRecv);
Code:
SendRecvClass.Self.Send(ByteArray); SendRecvClass.Self.Recv(ByteArray);