Hey, I need to send and get packeges via UDP and TCP in iPhones and the server. But, I figured that if I wanna send pacgages to a client (iPhone), he is... A kinda server. So, let's say I'm sending and getting packeges to iPhone via the port 2347. Do I need to open the port on the iPhone or something like that? Is there any Firewall built-in to the iPhone?
A:
No firewall on the iPhone. However, 99% of the time, the phone will not have a publicly accessible IP. It may be on wifi behind a router, or it may be on the cellular network most probably behind a NAT pool. Either way, you don't have access to any of those pieces of equipment, nor do your users in the cellular context (and potentially some cases of wifi usage). Think about doing this another way.
jer
2010-09-18 20:49:17
Hmmm.. What is the another way to get the pacgages? =/
EiTkoCaT
2010-09-18 20:50:55
99% of the time is perhaps a bit of an overstatement. Whenever the phone is on a WiFi, devices on the same WiFi can connect to it directly of course.
Nick
2010-09-18 20:53:58
The app is not for users in the same router, the app is an MMORPG - lot users from all over the world getting and sending pagacges to the main server.
EiTkoCaT
2010-09-18 20:57:23
Why do you need the users to act as servers then?
jer
2010-09-18 21:02:54
Other way to send packages from the main server to the users? Sending from the iPhone is not a problem, getting from the server is the problem.
EiTkoCaT
2010-09-18 21:07:32
Send the data back to the IP you got the request from, let the NAT on their end handle mapping it from the public address to their private address.
jer
2010-09-18 21:43:43
I don't really think I understood what you said..
EiTkoCaT
2010-09-18 21:48:31
Then you really shouldn't be thinking about making a networked application until you understand how networks you know, work.
jer
2010-09-18 22:26:01
I'm not perfect in English either, and I haven't understood what you said..
EiTkoCaT
2010-09-18 22:29:06
You say that a firewall on the router won't be a problem, if I send the data to the exact IP i got the data from?
EiTkoCaT
2010-09-18 22:32:59
Once you open a socket to your server, you can freely send data back and forth until one end closes the socket. Network programming is not simple and you should have some knowledge of how networks work before you start.
rpetrich
2010-09-19 05:41:50