views:

42

answers:

1

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
Hmmm.. What is the another way to get the pacgages? =/
EiTkoCaT
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
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
Why do you need the users to act as servers then?
jer
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
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
I don't really think I understood what you said..
EiTkoCaT
Then you really shouldn't be thinking about making a networked application until you understand how networks you know, work.
jer
I'm not perfect in English either, and I haven't understood what you said..
EiTkoCaT
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
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