|
|
|
Interresting. That means that the compiler reuses anonymous types within the same assembly if they have the same set of members. I wonder if the language is defined to work that way, or if the code is exploiting an undefined behaviour...
A bit of a kludge, anyway, as you have to create another instance of the type to be able to cast to the type.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Yes its an ugly hack no doubt about it.
The strange thing about it is that:
var a = new { foo = 123 , bar = 678}
and
var b = new { foo = 777 , bar = 123}
Gives the same type.
But:
var b = new { bar = 123, foo=777}
Gives a new type, even tho the type have exactly the same members.
(the compiled class will have different constructors, ctor params are specified in the same order as the properties)
And if I recall correctly then this is a language feature because some MS guy wrote about the above as a bug, and then Eric Meijer(or some other linq guy, dont remember 100%) told him that that was the intended behaviour according to the c# specs.
|
|
|
|
|
I created a Setup project for an application, and I built the setup.exe and .msi files for this application. I then ran the installation on another PC and the application ran fine until I removed the .exe and .msi files from that PC. Once that occurred, the application kept looking for those files as long as I tried to start the application with the shortcut that was created at installation time on the User's Programs Menu. Since those files no longer existed on the PC, the application would not run via that shortcut.
So, I manually created a new shortcut to the executable, and the application runs fine when started via the new shortcut. What I can not figure out is what property is causing the shortcut created via the install to expect the setup.exe and .msi files for the install to still exist on the PC. This is not a published executable, but there must be some obvious property I am not setting properly. Can anyone tell me what might be causing the shortcut created on the install to continue to expect the existence of the setup.exe and .msi files?
Thank you...
|
|
|
|
|
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
|
|
|
|