Is there a public UDP site to test ObjC code? - ios

I'm attempting to learn UDP coding as a neophyte.
I've been doing iOS development for years and want to start learning to do some basic network coding using the UDP protocol.
Is there a practice site to play with where I can't do any harm?
Or... is it possible to merely wire up the Apache server that comes with OS X and work with that?
This is intended to be for an iOS environment so would at least have to work via simulation.

Apache is an HTTP server, HTTP being a protocol built on TCP not UDP. You're probably going to be best off trying to write both a client and server that run in the same application and having them talk to each other via UDP.
FWIW, DNS is based on UDP, so talking to a public DNS server might be a good starting point.

Related

Is there any straight way to establish P2P UDP connection behind NAT in delphi?

I've been trying to establish a P2P connections for a couple of weeks. After writing some code and using Indy's components, I've realized that it can not access the peer that is behind the NAT. Furthermore, I've heard about STUN services that provide a client's remote and local IPs and ports. I should say I've already had the other UDP client (server) remote and local IPs, so how can I implement my code and program to work properly? Is there any extra component in Indy's library that I should use?
There is the Ares Galaxy P2P Project I know about some years ago.
There was a recent fork by Christian at https://github.com/CWBudde/AresGalaxy which tries to port it to more modern Delphi versions.
It is a work in progress, but perhaps you may get some very good ideas in this source code, and ask Christian for help/ideas, especially about NAT transversal.

Cross Language Middlewares

I am developing a gaming server for playing cards that needs a persistent connection between clients and this server.
so the server will accept connections from multiple clients, each of them has been developed with a different programming language.
I know that C# uses .Net remoting and java uses RMI, but I don't know if there is any middleware that can be used for various programming languages.
Any ideas ?
Yes there are plenty ...
There are two things you need to think about:
In which format do you want to transfer the data:
text (XML, JSON)
Binary (Protocol Buffers, ...)
How do you want to communicate with the server
HTTP (REST, WEB Services, ...)
Messaging (ZeroMQ, ...)
other protocols (RPC, RMI, ...)
Most of the communication works one way to the server and the server answers. This way for an interactive card game, you'd need to bug the server every few seconds if something has changed. Even though, it's the easiest way, it can introduce high latencies.
A way around this, would be:
Streaming - you can open a stream as a response and feed updated data to the client
bi-directional communication
Since bi-directional communication is almost never possible (because clients are in private networks behind firewalls) let's have a look at streaming.
We've implemented ~5-6 years ago streaming from C++ SAO-WebService to a .net client and it worked perfectly fine. http://www.webrtc.org/ is something new, for Real-Time-Communication (RTC) on the web. There are server endpoints implemented the most common languages / technologies and client endpoints shouldn't be limited to JavaScript only. But if you want to go more low-end, you can also always open a socket connection to the server and listen on incoming messages. However you loose the benefits of HTTP and other high level protocols.
I've explained parts of this in more detail, when answering the following question: What is the use of REST in distributed web application

How to handle firewall restrictions while building chat apps?

I am building a simple chat application using a jabber based server. The clients are expected to connect over port 5222. But, when i was testing my app, I found that in some networks access is limited to port 80 or 8080 only.
I have came across a couple of solutions:
a) Use BOSH - but found it to be slow and flaky on mobile devices.
b) I was just wondering what if i make my jabber server listen on port 80 - (Not sure what would be the implications of this!)
I wanted to know your thoughts on above solutions and know how to make my app universally accessible like other chat applications like gtalk , fb-chat etc.
Edit:
Also, would there be any other firewall restrictions that i might be missing?
Use BOSH over HTTPS (port 443/tcp). Getting BOSH implemented well is a little tricky, but it can certainly be done. Use a different XMPP library.
Otherwise, use port 443/tcp, and use the old-style TLS-handshake-first mechanism that we used to use for encryption, rather than Start-TLS. Some network middle-boxes will mess with your traffic on port 80/tcp if it doesn't look like HTTP. Likewise, some middle-boxes will not allow your connection on 443/tcp if the first several network packets don't look like a SSL or TLS handshake.

How can I make my iPad a TCP Socket Server?

Can anyone point me to an example or an explanation of how to get a server going on an iPad? I want to use TCP sockets and I've already downloaded the current AsyncSocket stuff but it's trickier looking than I thought. I've been researching but everyone talks about iOS as the client and some PC as the server. I would like to set up my iPad as a local server for a game I'm writing.
You can use the C socket api. Every valid C standard library is also valid in Objective-C. Here is a nice guide for programming sockets with C.

Delphi transparent proxy for a TCP connection

Anyone know of any examples of a TCP sockets proxy application written in Delphi? I am building a small broker application that needs to listen for socket connections on a given TCP port, read a XML data packet sent over the connection, serve the request via TCP to a server chosen from a pool of available back end servers, and deliver the resulting response back to the originating TCP connection.
I am very familiar with TCP and socket-level programming, but would prefer to find sample code as a starting point. If there is something available it would save considerable time and effort since I would not need to reinvent the wheel. I recall seeing a small TCP proxy written in Delphi back in 2003/2004, but seem to have lost track of the link.
Are you looking for a socks proxy implementation? If not, then just start with a server (http would most likely be a good start) and build into it the ability to process your inbound XML data packet, and make the appropriate calls. Something like the Synapse framework would make that a fairly simple project. If you grab Synapse, get the latest version from SVN. It supports all of the latest versions of Delphi.
There is a httpproxy demo for synapse available, that might help if your wanting to implement something more traditional. A good starting http server example is also available.
IPWorks from nSoftware should be considered as a commercial alternative to Synapse. They also have some Biztalk adapters available.
I've used both Synapse and IPWorks, and they are both quite good. I haven't used the referenced BizTalk adapters.
BizTalk Adapters
IPWorks

Resources