How to increase the priority of a TCP packet in Delphi?

I have a server application that receives some special TCP packet from a client and needs to respond to it as soon as possible by sending a high level ACK to the client (TCP ACK will not satisfy my needs).

However, this server is really network intensive and sometimes the packet will be too long to send (e.g. 200ms on a LAN where a simple server application can send it in less than 1ms).

Is there a way to mark this package with a high priority tag or something similar in Delphi? Or maybe with Win32 API?

Thanks in advance.


Thanks for all the answers. I'll add some details. My product has the following setup: there are several devices that are built on cars with WIFI connectivity. When they arrive at the garage, these devices connect to my server and start transmitting data.

Due to hardware limitations, I have implemented a high level ACK to tell the device that the last packet arrived successfully (please don’t argue about this - the data may get corrupted even if I received the correct TCP ACK), however, if I use my server software software that communicates with the remote database to issue this ACK, I get a very long latency (> 200ms). If I use exclusive software for this task, I get small delays (<1ms). So, I was imagining if I could just tell Windows to send these special packets first, as it seems to methat this packet is delayed so the databases can be delivered.

This is the motivation behind my question.


As requested: This is legacy software and I am using the deprecated package dclsockets140.bpl and Delphi 2010 (14.0.3593.25826).


source to share

2 answers

IMO this is very difficult to understand. there is a lot of hardware and software. first of all, if you are communicating between two different OS, you got latency. secondly, soft and hard firewalls, antiviruses, everything filters / delays your packet.

you can also try to "hack" the system (this is due to a very good knowledge of how to pack / send frames / segments, control flow, overloading, etc.), either by modifying it from code or using some tools like or others.



In short, passing MSG_OOB

to a function send

puts the data as "urgent". A detailed discussion of OOB in the context of Windows Sockets implementation specifics is available here .



All Articles