Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    client server implementation


    Hello,

    I am inplementing the multiple clients and single server. In client side my inputs are
    no of connections, no of tcp connectons, no of udp connections, host ip, port no.
    ./client -socket 10 -tcp 5 -udp 5 -host 127.0.0.1 -port 11113
    every thing working fine in Client side
    How do I make the server to accept all these connections. Can I assign differnet port no for each connection? any inputs are highly Appreciated.

    Thanks:

  2. #2
    Just Joined!
    Join Date
    Aug 2006
    Location
    india
    Posts
    57
    main()
    {

    open a stream socket
    bind it to a port,ip

    while(1)//continous to accept a client forever
    {
    newsocketfd = accept(clients);
    spwan a thread to serve each client that makes a connect request
    }
    //thread which serves each client
    function thread ()
    {
    do client request job;
    }

Posting Permissions

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