Very basic app with networking

Discussion in 'Mac Programming' started by sbandol, Jun 16, 2008.

  1. sbandol macrumors newbie

    Mar 3, 2008
    Hi all,

    I'm not sure if this is the best place to post such a basic question , but i will try.

    So , I'm trying to make an application witch will look like this

    The idea is that when i will press the button "ping" the application shall send to at predefined IP a command (a simple ASCII string, "ping" in this case) . This IP corespond to a hardware that recognize this command and will answer to this with "pong".
    When the application will recieve the "pong" it will put the pong.button in active state

    The communication between my application and the hardware is TCP/IP based, the hardware have a SOCKET always opened as a server and will listen all that is receiving thru the port 8000.

    The program from the hardware side is already done and i cannot change it.
    I already have a windows app that are doing the same , but i dont know ho to do this in Xcode.

    So i have to add an action to the buttons to : when i press a button , this will open a socket (client) and will send a predefined command to predefined IP thru the port 8000. Also the application have to receive the answer from the hardware , and put the corresponding button in correct state.

    I know that some of you will say to begin with very basic Cocoa learning, but i already did this and i don't have enough time to finish it to time.
    I will appreciate any help from you, I know that the time of each of you are priceless but maybe some of you can even make this litle app send me the project.

    If i can provide you other info about this app , please contact me.

    Thank you!
  2. sord macrumors 6502

    Jun 16, 2004
    If you need a quick and dirty...I see you already have your interface, so create an AppController with 1 action (ping: ) and 2 outlets (pingButton and pongButton). Connect your outlets to your buttons and your ping button to your action.

    If you used sockets in C/C++ on Windows using standard sockets API, you can reuse your code, minus the WSAStartup or whatever its called and other winsock specifics. You will need to create an NSThread to watch for response, passing the thread your AppController to enable your Pong button when response is received.

    That should give you enough to google your way through it I think.

Share This Page