Mac Cocoa And UDP

lostingamma

macrumors member
Original poster
Apr 4, 2005
32
0
I have been trying to find information on Cocoa and UDP, but I have been unsucessful. I wish my program to send a UDP Packet the IP Address and Port I specifiy. I would also like it to be able to recieve UDP Packets that were sent from the server. This program will communicate with a server, send it information, and recieve information. The information it recieves from the server should then be placed into a variable for later use. I have done it in Visual Basic, but I wish to now do it in Cocoa. :)
 

ITASOR

macrumors 601
Mar 20, 2005
4,400
3
Ew, I know Visual Basic....it's gross. Good job trying out Cocoa, I heard it's really good. I still have to install xCode and check it out.
 

robbieduncan

Moderator emeritus
Jul 24, 2002
24,587
57
Harrogate
There is no Cocoa specific way of doing this (at least built in, there are third party libraries). Objective C is a superset of C. Look for resources on Unix Network programming (using C).
 

lostingamma

macrumors member
Original poster
Apr 4, 2005
32
0
lol

lol, i didn't even think about that, your right, i found tons of c tutorials, i didn't even think abou the fact that u can use c in cocoa
 

jcgerm

macrumors member
May 28, 2003
91
0
lostingamma said:
lol, i didn't even think about that, your right, i found tons of c tutorials, i didn't even think abou the fact that u can use c in cocoa
You can actually use a combination of BSD sockets and CFSocket. You can setup the connection with BSD sockets and then use CFSocket to read/write from the connection you setup. It should be easier since CFSocket is a higher level API and you can use streams to get data from the socket(s) you're dealing with. Which, in my opinion, is easier than dealing with finite size buffers with BSD sockets.