Sending Packets Using TCP/IP to Use in XCode - xcode

I'm very new to network programming, and would appreciate some help understanding what some good progress steps would be. I am designing an iOS app that requires real-time information to be delivered over a network from another machine. I know the IP address of this machine, as well as the API that the machine adheres to in terms of sending and receiving messages.
From doing some research, it seems like I need to open up a socket on one of the machine's ports, and open up another socket on my computer, and then use TCP/IP to send and receive packets between the two.
What is a good overview of the process that I need to do at this point? Which languages and environments would you suggest that would be most efficient for me to be able to get the information I need from this machine into my XCode project?
Thanks! Any help would be appreciated.

you just need to look for examples of how to do "socket programming" for IOS. here's one resource:
http://www.tekritisoftware.com/sites/default/files/Socket_Programing_for_IOS.pdf

Related

Can I send SNMP Traps to a different network?

I'm trying to send and receive an SNMP trap using an Ubuntu VM. Works well if I send and receive it in the same VM. But is it possible to send it to another Ubuntu VM in a different network or sending it through the internet?
Used a ton of tutorial like this but with no luck.
Any tutorials or guides for this? Been searching for days. Any help would be great. Thanks!
Yes, of course, but you will need to open up your firewalls and/or set up port forwarding so that the packets go where they need to go when they cross any network boundaries. The specific details depend on your network layout and cannot be further explained in the abstract.

p2p direct data exchange...via HTTPS?

Is there any protocol, API or software in existence that can send data/IM/etc directly from one device to another with no server?
Can you not use HTTP GET/POST/DELETE directly between two devices when their device data is known to the user(s)?
I would very much like to know if there is ANY software/protocols that can do this.
thank you!
The internet is build on the Internet Protocol suite. This suite has 5 different layers of protocols: The physical layer, the link layer, the network layer, the transport layer and the application layer. Each depends on the one before.
If you just use the browser, by default HTTP (application layer) is used, which relies on TCP (transport layer), which relies on IP (v4 or v6, network layer), which relies on ethernet (link layer), which finally relies on the actual cable that's plugged into your computer (for WiFi, the first three are the same but the last two differ if I'm not mistaken).
Now to your question: Is there any protocol, API or software in existence that can send data/IM/etc directly from one device to another with no server?
Yes there is. I suggest you start looking at protocols that are in the application layer. To highlight a few standards next to HTTP(S): FTP is for file transfer, IMAP is for emails clients, SMTP is for email servers and SSH is a secure shell which can also be used to tunnel data through.
For your specific case, I think either FTP (FTPS if you want it over SSL), or SSH can be a solution, but it's hard to know for sure without the specifics.
The only thing that these protocols have in common is that one of the two computers will act like server and the other computer as client. This has as downside that port-forwarding might be necessary.
If you've chosen the protocol you'd like to use, then you're up for the next step, selecting a program that can do that for you. For HTTP(S), I'd recommend Apache. If you're using Linux and chose SSH, then you're in luck, there is a build in SSH server in Linux, you can use that. For other protocols, you might just want to search yourself, as I do not have any suggestions.
I hope this answers most of your questions!
Desirius
In browser context, WebRTC is probably what you are looking for: It allows user to user communications.
https://en.wikipedia.org/wiki/WebRTC
https://webrtc.org/

How does a device become SNMP-enabled?

I have a general question but I could not find any useful information to answer it.
Just to be clear, I do understand how the SNMP works (Manager, Agent, MIB).
What I do not understand is how a device becomes SNMP enabled?
Does it happen at the manufacturing stage?
Can anyone explain this to me, please?
SNMP is a protocol (set of rules) for device communications. An application on the device opens a network port, listens for connections, and responds to those connections. It's similar, at least in theory, to a web server or any other kind of server. Usually the SNMP server software will be written into firmware on the device by the manufacturer, but for computers it may be loaded at boot time or on demand.

Creating a Server for phone or sms

This is my newest project which consists of making a Server for phone and sms. I would like to do something like google talk where one would be able to make calls and receive calls or even text through the internet.
I would than be able to connect a land line phone or even just a microphone and call my cellular and talk. Otherwise just sending a sms message through the internet to my cell would be awesome as well.
Any Reference or guides would be much appreciated.
Notes:
Yes I know there are websites that do these things. Not what I am asking.
I got a Windows Server 2008 r2 setup at home.
I think I am a decent programmer, enough to be able to program this if I have some clue what I should be searching for.
Do not tell me it is impossible, as not too long ago I saw usb hardware that allowed to make calls over the internet (I know it's more complicated than that but I want to have this knowledge)
Okay, as others have already suggested, Asterisk is one the most obvious ways to go. Some time ago we created an online solution which allows most of the things that you have described, voip calling, dial plan generation, pbx, connection with landlines, sms sending, payments.
Tools used:
- LAMP (linux, apache, mysql, php)
- Asterisk
- OpenSer (http://en.wikipedia.org/wiki/OpenSER)
- 3rd party for SMS sending
- 3rd party for billing.
For phone you have two options:
not buying hardware and use voip. You can use some voip to land line gateways. There are many ways for achieving that. The most "professional" would be buying did number: http://www.voip-info.org/wiki/view/DID+Service+Providers. But there are other ways for example using skype api.
second option is connecting server to landline using special hardware - http://www.voip-info.org/wiki/view/FXO
Probably the funniest part would be writing webgui since writing PBX part could be little tricky. You should consider using Asterisk (free, Open Source) - Linux or 3CX (non-free) - Windows.
Regarding sms:
You can use sms gateway i.e.: http://www.clickatell.com/
You can buy gsm modem to your server
For the SMS part there is the SMSLib (http://smslib.org/), where you can use an attached phone to send and receive SMS.
You could provide a webinterface to write and read the SMS then of course, that would be the easier part.
For the calling I don't know, but it should be possible too. I know there are GSM chips for e.g. arduino but I guess it is very hard to reroute them to the application on the server. It could be possible with a short delay though.
Another option is to look into a VOIP library, e.g. Asterisk (http://www.asterisk.org).

Simulating latency when developing on a local webserver

The Performance Golden Rule from Yahoo's performance best practices is:
80-90% of the end-user response time
is spent downloading all the
components in the page: images,
stylesheets, scripts, Flash, etc.
This means that when I'm developing on my local webserver it's hard to get an accurate idea of what the end user will experience.
How can I simulate latency so that I can understand how my application will perform when I've deployed it on the web?
I develop primarily on Windows, but I would be interested in solutions for other platforms as well.
A laser modem pointed at the mirrors on the moon should give latency that's out of this world.
Fiddler2 can do this very easily. Plus, it does so much more that is useful when doing development.
YSlow might help you out. YSlow analyzes web pages based on Yahoo!'s rules.
Firefox Throttle. This can throttle speed (Windows only).
These are plugins for Firefox.
You can just set up a proxy outside that will tunnel traffic from your web server to it and then back to local browser. It would be quite realistic (of course it depends where you put the proxy).
Otherwise you can find many ways to implement it in software..
Run the web server on a nearby Linux box and configure NetEm to add latency to packets leaving the appropriate interface.
If your web server cannot run under Linux, configure the Linux box as a router between your test client machine and your web server, then use NetEm anyway
While there are many ways to simulate latency, including some very good hardware solutions, one of the easiest for me is to run a TCP proxy in a remote location. The proxy listens and then directs the traffic back to my final destination. On a remote server, I run a unix program called balance. I then point this back to my local server.
If you need to simulate for a just a single server request, a simple way is to simply make the server sleep() for a second before returning.

Resources