Results 1 to 2 of 2

Thread: Sockets Help

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2002
    Posts
    86

    Sockets Help

    I have a few questions about socket programming with my program. I found this site http://www.cs.rpi.edu/courses/sysprog/sockets/sock.html for programming sockets I C and unix (which is what I am using). The program is called Memory, where you have N cards arranged on the board and you have to match them up. Any number of players can connect to the server.

    I really dont understand how to approach this with a client server design. My prof said to handle the requests sequentially but I have no idea how to do this, and we're not supposed to use threads.

    Here is the basic program for the server:
    There is an array of player structs
    create the board and initialize stuff
    create and bind socket for server
    wait for connection from client
    receive/send info from players

    I'm making it so that when the player wants to send something, the first "parameter" of the message says what the player is doing and after that is all the neccessary info, and same with the server.

    What I'm having trouble understanding is the whole idea with multiple sockets and the different players. So does each player need to have their own socket to send/receive or do they use the same socket? Any clarification about sockets is appreciated.

    [EDIT]
    Just to clarify, I dont understand how the server is to determine which player sent the info for the game.
    Last edited by fartman_900; Oct 14th, 2006 at 08:59 AM.

  2. #2
    "Digital Revolution"
    Join Date
    Mar 2005
    Posts
    4,471

    Re: Sockets Help

    You are doing this in C++?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width