Khaled
Khaled

Reputation: 1194

Socket change in LSP

Is it possible to change the destination socket (IP and port) of the outgoing packets using LSP (Layered Service Provider) in Windows?

For example, I want to redirect all HTTP packets to a proxy server (given IP/port). This way I can create "system-wide" proxy for Windows.

I tried to include a call to WSPSendTo inside the function WSPSend to do the redirection. These two functions take the same parameters except that WSPSendTo takes two more parameters (const struct sockaddr FAR *, and int).

The problem is that the traffic has not been directed to the proxy specified in the code. I verified this using wireshark!

Upvotes: 0

Views: 819

Answers (1)

Hasturkun
Hasturkun

Reputation: 36412

You can't change the destination of a TCP socket once it has been connected, which is why calling WSPSendTo (with non NULL lpTo) has no effect. You should look at WSPConnect instead.

Upvotes: 2

Related Questions