First, you never, ever send directly through the Socket object. Only through a Security object. Be sure you don't do this or you will have disastrous bugs!Quote:
About sending packets : How i send packets with this simplest proxy example ? I mean ;
remote_context.relaysecurity.send or
remote_context.socket.send or with whatever?
Even though i tried both , packet isn't being sent to server.
It's kind of hard to explain clearly because it all depends on "perspective". Let's start out with the GatewayServer to make things simple.
local_context - The context for your sro_client and proxy connection.
remote_context - The context for your proxy and SRO server connection.
The "perspective" you are at is that of the proxy. So for example: sro_client <-> [proxy / you] <-> Silkroad server. When you send to the local_context, that means you are sending data from the proxy to sro_client. When you send to the remote_context, you are sending data from the proxy to the Silkroad server.
To inject data to the server, you would need to send data to the remote_context's security object directly. So, remote_context.Security.Send(...);
To inject data to the client, you would need to send data to the local_context's security object directly. So, local_context.Security.Send(...);
The "RelaySecurity" object is to make "forwarding" packets easier from one direction to the other, but it's not for the injecting data logic that you need.
It takes some thinking through, but try to imagine a proxy as just being an emulator (sro_client <-> proxy) + a clientless (proxy <-> SRO server). If you want to send data to the server, you have to use the remote_context object since that is your clientless object. If you want to send data to the client, you use the local_context since that is your emulator.
I hope that clears it up!