|
Hi there,
i have written a port-forwarding tool for a special software i use for an online game project.
everything works fine, but the server only get the client-ip from the forwarding server, not from the user.
Everything is working with TCPclient Class.
So, is there a posibility to edit the senderip in a packet, i send?
For example:
Client-IP=88.88.88.88
Forwarder-IP=99.99.99.99
Server-IP=11.11.11.11
1.the client connects to the forwarder
2.the forwarder accept the connection if some checks have been made...
3.the forwarder connects to the server
4.the forwarder forwards all messages from the client to the server and backwards.
additional to 4: on point 4, the forwarder should modify the packet data on send, that the server sees client-ip 88.88.88.88. but at the moment, it sees 99.99.99.99.
Maybe you can help me?
Thanks for all replies.
janwe
|
|
|
|
|
You'd have to rewrite the packet in raw mode to do this. The problem is you really can't do that under Windows XP SP2 and above because of security concerns.
|
|
|
|
|
Thank you for your reply!
what about windows server 2003 enterprise?
could it work there?
if so, are there any examples availlable?
|
|
|
|
|
Jan Weltmeyer wrote: what about windows server 2003 enterprise?
Not a chance.
|
|
|
|
|
Hi,
This essentially cannot be done, since the sender address is used by the server to send the response packets back to the client. If you fake the sender address, the TCP connection won't even get past the SYN-ACK phase (as the server will attempt to reply to the forwarders SYN packets with a FIN an ACK directly to the client - which will fail in most scenarios as the client won't have a half-open connection matching it). So - getting even the first payload into the server application would fail. This is why simple "spoof attacks" can only cause damage (unless the targets have seriously broken TCP/IP stacks) using connectionless protocols (UDP, ICMP etc). They can't get to any actual data using TCP.
Note that what you "Write()" to the TcpClient socket is NOT a packet. It is a payload. It will be sent in one or more actual packets over a connection established with a two-way initial packet exchange, each of which will be acknowledged or retransmitted by the sender - the client in this case. If you *really* want a one-way only packet transfer you can use UDP (but then you have to build your own acknowledgement/retransmit mechanism). Then, you could in theory spoof the sender IP (but like another poster noted, Windows and/or the framework will most likely not let you).
TCP-based application layer gateways (ALGs - such as those found in firewalls) handle it this way:
1. They keep track of their clients and forward the response traffic to the appropriate client based on the server IP and the port numbers used (as each client get their own sender port allocated by the forwarder - which becomes the receiver port in replies).
2. Some applications (FTP, for instance) insert the IP addresses in the packet payload (protocol commands). In this case, the ALG has to rewrite the commands (replacing the client's IP address and port(s) with its own) and then use method 1 as well.
Some protocols (such as SIP and other telephony applications) have more elaborate methods of handling ALGs - the ALGs become part of the protocol and actually tell the server that they're involved (as in "hi, this is me on this IP address, but I'm actually working on behalf of this guy on this private IP address that you can't see, so please let me know if you want to talk to him and I'll handle it for you"). This increases complexity by a factor of ten and explains why VoIP is sometimes such a royal pain in the a**... Even telephony operatores sometimes can't configure it correctly...
Later,
--
Peter
modified on Wednesday, May 14, 2008 4:18 AM
|
|
|
|
|
Okay. Very nice and Detailed information.
So i think i have no real chance to workaround my problem.
I will look for any other solutions, and writing it down here if I have one...
Thank You very much,
Jan
|
|
|
|
|
Can anyone briefly tell me how asyncallback work.
How asyncallback object or variable works, especially when they are used in threading manner.
Appreciate if anyone could help out
|
|
|
|
|
The AsyncCallback object is a delegate. The delegate points to a method that is called when the work finishes executing asynchronously.
For example,
Action doWorkFunction = DoSomeWork;
doWorkFunction.BeginInvoke(OnDoWorkCompletedAsync, null);
void DoSomeWork()
{
...
}
void OnDoWorkCompletedAsync(IAsyncResult result)
{
}
OnDoWorkComkpletedAsync will be called when DoSomeWork finishes asynchronously.
|
|
|
|
|
Hi,
Here is a good example
Regards,
Charith Jayasundara
|
|
|
|
|
Exactly what is the example? If you are going to respond, make sure you include links, copies of code, etc.
|
|
|
|
|
|
i need a client/server chat application that use it through internet (like Yahoo messenger),
i want to start server in my system and user(s) start client and chat together over internet, i want csharp code smaple and exe sample, can anybody help me (sample app or article)?
thanks
|
|
|
|
|
|
thanks Gareth
but i saw your link and it works in local network while i want work through internet.(not local network)
|
|
|
|
|
There is no difference in internet or intranet tcp/ip networking.
Just start the server up locally, if you have a router, you have to forward the needed ports to the server Computer.
The clients can connect to your Internet-ip.
|
|
|
|
|
|
Every....three.....days......
|
|
|
|
|
Hi All
Iwont to Use The WorkFlow In C#.Net , but i dont konw any thing abut it , who i can learn abut it
if any boudy know any web application It hellp me tell me it .
or if any boudy have any sample about it give me it .
Thanks about any hellp me
Thaer
|
|
|
|
|
There is actually a Windows Workflow forum here. See WPF/WCF/WF.
See here: http://netfx3.com/content/WFHome.aspx[^]
Also there are a number of short videos at MSDN Screencasts.
I have the book Pro WF by Bruce Bukovics which is very good.
Kevin
|
|
|
|
|
hi
i need to make Phone Dial in C#
is any one have sample code for it ?
thank's
|
|
|
|
|
|
not work !
is any one have asimple code for dial in c# ?
|
|
|
|
|
well, it probably depends on your phone.
you can connect to most phones using SerialPort (e.g. via bluetooth or usb virtual COM drivers).
next you`ll have to check out the AT command subset your phone supports.
then send those commands to your phone and you're finished,
/********************************************
* dies & das - dot & net
* http://blog.joachim.at
********************************************/
|
|
|
|
|
Hi...
I am writing a windows explorer toolbar that sets up a standard st of columns (like author, comments, etc..) so the user dosn't have to do it..(later will add more functions for handeling MS office documents etc..)
Now i have a working toolbar and have made my way through explorer to the lSysListView32 and using a LVCOLUMN managed to send the message that inserts the column..
But (allways a but) dose any one know how to tell explorer to populate the column with the info? I am only using standard columns (like author, comments, etc..)
Code So far...
<br />
private void button1_Click(object sender, System.EventArgs e)<br />
{<br />
MessageBox.Show("Button Clicked!");<br />
SendMessage(Explorer.HWND, LVM_COMMAND, viewREPORT, 0);<br />
IntPtr lSHELLDLLDefView = FindWindowEx(Explorer.HWND, 0, "SHELLDLL_DefView", null);<br />
if (lSHELLDLLDefView == null)<br />
{<br />
return;<br />
}<br />
IntPtr lDUIViewWndClassName = FindWindowEx(lSHELLDLLDefView, IntPtr.Zero, "DUIViewWndClassName", IntPtr.Zero);<br />
if (lDUIViewWndClassName == null)<br />
{<br />
return;<br />
}<br />
IntPtr lDirectUIHWND = FindWindowEx(lDUIViewWndClassName, IntPtr.Zero, "DirectUIHWND", IntPtr.Zero);<br />
if (lDirectUIHWND == null)<br />
{<br />
return;<br />
}<br />
IntPtr lCtrlNotifySink = FindWindowEx(lDirectUIHWND, IntPtr.Zero, "CtrlNotifySink", IntPtr.Zero);<br />
if (lCtrlNotifySink == null)<br />
{<br />
return;<br />
}<br />
IntPtr lSysListView32 = FindWindowEx(lCtrlNotifySink, IntPtr.Zero, "SysListView32", IntPtr.Zero);<br />
if (lSysListView32 == null)<br />
{<br />
return;<br />
}<br />
<br />
LVCOLUMN lvc = new LVCOLUMN();<br />
lvc.mask = 0x0001|0x0008|0x0002|0x0004;
lvc.fmt = 0x0001;<br />
lvc.cx = 100;<br />
lvc.text = "Author";<br />
<br />
int counter = 0;<br />
SendMessage(lSysListView32, 0x1000 + 97, counter, ref lvc);<br />
<br />
}
Not sure if this is the right forum but it is writen in C# but is probably more to do with good (well) old windows...
Many Thanks Calvin
|
|
|
|
|
This wont work. What you've done is told the listview to add the column, but Explorer doesn't know you did it and, hence, it wont fill the column.
You need to tell Explorer to add this column to the display so it also knows to fill in the data. The problem is there isn't a documented way to do this that I know of.
|
|
|
|