|
It's more of a cable. Take the power cable from the back of the computer, switch on the power at the mains and suck on it
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
Computafreak wrote: encoding your intentions onto the relevant sectors of the hard drive in the necessary patterns
Yes but how do I communicate that essence to others?
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
The link in my sig contains all the info you need.
Christian Graus
Driven to the arms of OSX by Vista.
Please read this[ ^] if you don't like the answer I gave to your question.
|
|
|
|
|
|
The keypress event will only be triggered if the form has focus. if you want other controls to perform the same function then you must use there keypress events too.
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
And if you have some 30 controls on a form?? Your solution doesn't sound like a good method to me.
|
|
|
|
|
Yeah I see your point, I was thou more concerned on saying why it wasn't working rather than giving a solution, yet one made its way in
Thou I suppose it depends on the usage, perhaps two different text boxes need to do two different things when the 'Enter' key is pressed. Sure you can check focus on the form's preview event, but then what if you want to process a textbox after input, to validate its contents for example (although I already thought you can calculate new value from key press) anyway, is circumstantial, that' all i'm saying
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
The form has a KeyPreview property. Set that to true and you form Key handlers will get first crack at the keystrokes before any controls on it do.
|
|
|
|
|
|
Before I can ask the question I'll have to describe the situation:
There is a server and there are some clients, but the only thing server does is remembering which clients there are and then giving that information to clients which ask for it. So far so good, except that the clients are listening on some port (which is fixed on the inside of their NAT, say 1000). But obviously this information won't do anyone any good - they'd need the outside port. But how can you get it? I tried binding the socket that talks with the server to the same inside port (so that the server would see the correct port) but then it fails to connect. And the client itself seems to have no way to detect what outside port it is using..
So, what can I do about this? Do I need to throw the entire design into the bin (if so, what should it be like?)
|
|
|
|
|
Two options;
1) you try to talk to every port possible, and see which one has a client that reacts.
2) you simply define the port that should be used. Such is done for email (25 and 110 are reserved for those, for instance), webpages (usually port 80) and proxy-servers (port 8080)
Other reserved ports can be found here[^].
Enjoy
I are troll
|
|
|
|
|
Ok let's not go into option 1 lol
And 2, well, normally would work, but not always (it can, but there is no guarantee) in the presence of NAT. And NAT is everywhere..
I mean, you can fix the local port, but the public port would essentially be random, and it's the public port that the outside world needs
|
|
|
|
|
I see you wrote this article: NAT Traversal with UPnP in C#[^], so maybe I don't understand your question, but here goes anyway:
If your clients are behind a NAT device, it is better not to initiate a connection from your server - get the clients to make the connections.
As for getting the public ip:port - it will be the one the server sees as the source of the connection attempt. The NAT device handles ( and hides ) the private network.
Nick
----------------------------------
Be excellent to each other
|
|
|
|
|
Ah well, the problem is, the server doesn't see the right thing. It sees a random port that was assigned to the socket by windows and trying to bind to prevent that results in inability to connect at all..
|
|
|
|
|
So, your server trying to initiate a connection to a client that is behind a NAT device? This is difficult.
Can't you get the clients to connect to the server? You can leave the connection open if you want the server to initiate data transfer over the connection. Or your clients can poll the server. It depends on what Application Layer protocol you're using.
Nick
----------------------------------
Be excellent to each other
|
|
|
|
|
Well yes sortof, the client would be trying to connect to an other client but that's pretty much equivalent (in regard to the NAT problem) to having the server do it.
The server is just supposed to store the addresses+ports of the clients so they can find eachother
A bit like bittorrent, but different (but it does mean that bittorrent clients have already solved this public port problem so it can't be impossible)
|
|
|
|
|
I'm not sure how bittorrent works, but most P2P networks nominate a peer that is not behind a NAT ( and can therefore be connected to ) to act as a server for a client that is behind a NAT. That's how Skype works - or at least used to work.
Generally, connecting to a client that is behind a NAT is too difficult and unreliable to be used in the design of a P2P network.
Ah, a bit of googling found this: http://www.codeproject.com/Messages/3001183/NAT-Traversal-in-Csharp-P2P-behind-firewalls-NAT-Routers-UDP-Hole-Punching.aspx[^]. Are you still trying to help this guy?
Nick
----------------------------------
Be excellent to each other
|
|
|
|
|
Bittorrent uses servers to store the clients' details (potentially these could be clients themselves, but usually not)
I'm afraid I'm not trying to help him anymore, I got lost in the woods of symmetric NAT and other crazy stuff for which there appears to be no solution at all.. they should never have invented NAT, it's a bad hack anyway
|
|
|
|
|
Hi Harold,
In a c/s situation the initiative is with the client.
servers shouldn't connect to clients at all if you ask me. That would be spamming.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Oh yes no that is not what it's trying to do - it's storing their address+port so that other clients can connect to clients directly (which is where all the trouble comes from really)
So the clients then go into P2P mode.. and they'll have to do that because otherwise the load on the server would be enormous
I guess I should have mentioned that lol
|
|
|
|
|
You real problem in that, from the server side, the clients NAT/Firewalls are going to deny all inbound connections anyway. The clients would have to open a well-known port on their end (firewall) to let other clients connect to them.
|
|
|
|
|
Yes but this presents a problem, the NAT device could choose to give the forwarded port an other public port because the regular one was already in use (others just error) how could I find out which?
|
|
|
|
|
The internet side of the NAT would open a single, well-known, port and forward that port to a well-known port your app is exposing. What you're talking about is the OUTBOUND port from your client to the server. THAT one gets a random port, not the inbound side.
|
|
|
|
|
Well that is part of the problem, the server can't just use socket.RemoteEndPoint because it's random
|
|
|
|
|
OK, you're not getting it...
The server doesn't need the port number at all since the clients receiving port number will be the same on every instance of the client. This is the "well-known" part. For example, SMTPs well-known port is 25.
But, since the NAT can do port forwarding, the port number the NAT exposes on the internet side can be different than the port exposed by the client to receive connections. The NAT needs to know what IP and port to send the traffic on that port to on the inside network.
|
|
|
|