Converting Raw HTTP Request into HTTPWebRequest Object

I dont believe there is an exposed method to do this. You may have to find or write a parser to break the request up and then write your own class that extends HttpWebRequest. Here is what looks like a parser from CodeProject: http://www.codeproject.com/KB/IP/CSHTTPServer.aspx I looked at the rotor code for the HttpWebRequest (briefly) and … Read more

Docker app server ip address 127.0.0.1 difference of 0.0.0.0 ip

You must set a container’s main process to bind to the special 0.0.0.0 “all interfaces” address, or it will be unreachable from outside the container. In Docker 127.0.0.1 almost always means “this container”, not “this machine”. If you make an outbound connection to 127.0.0.1 from a container it will return to the same container; if … Read more

An attempt was made to access a socket in a way forbidden by its access permissions

I had a similar issue with Docker for Windows and Hyper-V having reserved ports for its own use- in my case, it was port 3001 that couldn’t be accessed. The port wasn’t be used by another process- running netstat -ano | findstr 3001 in an Administrator Powershell prompt showed nothing. However, netsh interface ipv4 show … Read more

Tcp packets using QTcpSocket

If a large amount of data is sent, the packet can arrive in separate parts. Alternatively, multiple messages can be received in one readyRead slot. It’s good practice to control this by setting the first byte(s) to the number of bytes that will be sent. Then, in readyRead, you read the first bytes and append … Read more

Delphi Windows Service Design

fast answers: 1&3) Yes. As a rule of thumb do not implement the OnExecute service event. Spawn your own thread from the OnStart service event. The thread can be terminated when you receive the OnStop service event. 2) you keep your thread alive like this (execute method): while not Terminated do begin // do something … Read more

Boost::Asio : io_service.run() vs poll() or how do I integrate boost::asio in mainloop

Using io_service::poll instead of io_service::run is perfectly acceptable. The difference is explained in the documentation The poll() function may also be used to dispatch ready handlers, but without blocking. Note that io_service::run will block if there’s any work left in the queue The work class is used to inform the io_service when work starts and … Read more

What is the cost of many TIME_WAIT on the server side?

Each socket in TIME_WAIT consumes some memory in the kernel, usually somewhat less than an ESTABLISHED socket yet still significant. A sufficiently large number could exhaust kernel memory, or at least degrade performance because that memory could be used for other purposes. TIME_WAIT sockets do not hold open file descriptors (assuming they have been closed … Read more