Cocoa And UDP

Discussion in 'Mac Programming' started by lostingamma, Jun 12, 2005.

  1. lostingamma macrumors member

    Apr 4, 2005
    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. :)
  2. ITASOR macrumors 601


    Mar 20, 2005
    Ew, I know Visual's gross. Good job trying out Cocoa, I heard it's really good. I still have to install xCode and check it out.
  3. robbieduncan Moderator emeritus


    Jul 24, 2002
    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).
  4. lostingamma thread starter macrumors member

    Apr 4, 2005

    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
  5. jcgerm macrumors member

    May 28, 2003
    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.

Share This Page