Hi!
>>>>> "Roman" == Roman Bednarek <roman@stripped> writes:
Roman> Hi.
Roman> I am trying to write an proxy server for Mysql.
Roman> I do not want to parse the packet contents, in order to reduce
Roman> dependency on protocol changes.
Roman> For now I have the following:
Roman> packet from server
Roman> packet from client
Roman> packet from server
ok start.
Roman> loop:
Roman> packet from client
Roman> packet from server
Roman> if(packet[4]=-1) continue; //error
ok
Roman> if(packet[0]=0) continue; //update
ok
Roman> while(packet[4]!=-2 || packet.length!=1)
Roman> packet form server
Send fields; ok.
Roman> while(packet[4]!=-2 || packet.length!=1)
Roman> packet from server
Send data; ok.
I assume that packet.length is the value of the 3 first bytes.
Roman> It seems to work, but I do not know if it is not too simplified?
Roman> Are there any other posibilities in the protocol?
It doesn't take into account
- 'LOAD DATA LOCAL INFILE'
In this case the client will send a stream of packages to the
server.
- replication, where there is much more communication between server/client
- compressed protocol
But if the above isn't important for you, the above should be ok.
Regards,
Monty