soHardcore
soHardcore

Reputation: 23

Spoof IP address for HTTP web request?

I have a web service on a server in my company that we have restricted access to from all but one other server on our network.

I do however need to make calls to this from another machine. Is there a way I can spoof the other servers IP address in order to send an http request to the web service? I only need to send it info I don't need any returned data. It's for logging hits from another server on our main server.

I am using this

IPEndPoint endpointAddress = new IPEndPoint(IPAddress.Parse(ipAddress), 80);
using (Socket socket = new Socket(endpointAddress.AddressFamily, SocketType.Stream, ProtocolType.Tcp))
{
    socket.SendTimeout = 500;
    socket.Connect(endpointAddress);
    socket.Send(byteGetString, byteGetString.Length, 0);
}

but get an exception

A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 23.202.147.163:80

Upvotes: 2

Views: 3544

Answers (2)

glowworms
glowworms

Reputation: 410

You could use a proxy to bounce your requests from an IP address that has access.

Upvotes: 0

Greg Hewgill
Greg Hewgill

Reputation: 992917

In general, it is not possible to establish a TCP connection with a server without being able to receive and process some reply packets from that server. HTTP is built upon TCP, and TCP starts communications with a "3-way handshake" that lets the client and server communicate.

The start of an HTTP request is not a single packet.

Upvotes: 5

Related Questions