#1 2024-01-18 09:31:36

cadnan
Member
From: Sweden
Registered: 2020-09-22
Posts: 16

Creating a server/client with a custom TCP protocol

I would like to create my own application (instead of the one delivered by a vendor) that communicates with a proprietary system.
They are using a custom/proprietary TCP protocol, but luckily I have a Wireshark dissector for it.

My question is if anyone can give me some hints/tips/starting points in how to achieve this in mORMot2?

My guess is that I will spend a lot of time in mormot.net.sock unit smile but if someone has a public repo or an example of how one defines custom TCP header, message length bytes etc.. it would be really helpful.

Thanks,
+adnan

Offline

#2 2024-01-18 13:54:21

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: Creating a server/client with a custom TCP protocol

In mormot.net.sock you have a TCP client as TCrtSocket class.

In mormot.net.async you have an event-driven TCP server as TAsyncServer class.
You just need to inherit your own processing class from TAsyncConnection, and overwrite the OnRead method.

See mormot.net.rtsphttp for a sample of how to deal with a proprietary TCP protocol.
Note that THttpAsyncConnection/THttpAsyncServer are also an example of TAsyncServer implementation with a custom TCP protocol, which is HTTP. wink

Offline

#3 2024-01-19 08:24:41

cadnan
Member
From: Sweden
Registered: 2020-09-22
Posts: 16

Re: Creating a server/client with a custom TCP protocol

Thanks Arnaud!

Indeed, HTTP is a prime example of a custom TCP protocol big_smile

Offline

Board footer

Powered by FluxBB