CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Join Date
    Jul 2012
    Posts
    6

    Post creating multiple ports at server and client

    Hi... i am new to the network programming.

    i want solution for creating multiple ports at both server and client sides using c/c++.

    My main idea is to send requests from different clients to server(ex:to port1) and receive data from server( from another port 2) and at the receiver side again i want new port to receive data from server to each client.

    Is it possible to do like that???
    please give suggestions

  2. #2
    Join Date
    Mar 2001
    Posts
    2,529

    Re: creating multiple ports at server and client

    Sounds like all you need is a basic socket server and client. Here is
    the code you request, along with some more goodies.
    http://cs.ecs.baylor.edu/~donahoo/pr...ets/practical/

    Look at TCPEchoServer.cpp and TCPEchoClient.cpp, plain Vanilla Sockets is probably the way to go.

    HTH,
    ahoodin
    To keep the plot moving, that's why.

  3. #3
    Join Date
    Jul 2012
    Posts
    6

    Re: creating multiple ports at server and client

    thank you very much for your reply.
    my main idea is described in the following image.
    please suggest code for this in c language.
    Name:  Untitled.png
Views: 1525
Size:  13.1 KB

  4. #4
    Join Date
    May 2001
    Location
    Germany
    Posts
    1,158

    Re: creating multiple ports at server and client

    Why do you think you need such a design. Normally, one socket connection per client would be enough.

  5. #5
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,654

    Re: creating multiple ports at server and client

    It seems like you need something similar to passive FTP http://slacksite.com/other/ftp.html
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    https://visualstudio.microsoft.com/vs

  6. #6
    Join Date
    Mar 2001
    Posts
    2,529

    Re: creating multiple ports at server and client

    Looks like the diagram for old BOOTP.

    Any similarities?
    ahoodin
    To keep the plot moving, that's why.

  7. #7
    Join Date
    May 2001
    Location
    Germany
    Posts
    1,158

    Re: creating multiple ports at server and client

    Well, this FTP feature came to my mind right after my previous post...

  8. #8
    Join Date
    Jul 2012
    Posts
    6

    Re: creating multiple ports at server and client

    Quote Originally Posted by Richard.J View Post
    Why do you think you need such a design. Normally, one socket connection per client would be enough.
    Actually i want send jumbo frames [5000bytes] from each client to sever.
    My idea is, if we send both request messages from different clients to a particular port on server and send data to same port on the server will decrease the throughput. so i want to send data from clients to different port on the server side.
    Is this idea is correct ???

  9. #9
    Join Date
    May 2001
    Location
    Germany
    Posts
    1,158

    Re: creating multiple ports at server and client

    Quote Originally Posted by bhanubtech35 View Post
    Is this idea is correct ???
    I don't think so. You must think in terms of connections, not ports. A connection consists of the tuple (local IP address, local port, remote IP address, remote port, protocol). So if each client establishes 1 connection to the server, everything can be sent via this connection. A separate data connection would not necessarily increase the overall throughput, IMO.

  10. #10
    Join Date
    Jul 2012
    Posts
    6

    Re: creating multiple ports at server and client

    can you explain any solution for this problem.
    (Here we are using UDP for sending packets.)

  11. #11
    Join Date
    May 2001
    Location
    Germany
    Posts
    1,158

    Re: creating multiple ports at server and client

    Quote Originally Posted by bhanubtech35 View Post
    Actually i want send jumbo frames [5000bytes] from each client to sever.
    Quote Originally Posted by bhanubtech35 View Post
    (Here we are using UDP for sending packets.)
    For all I know, this seems to be not the best approach. Since UDP packets can not be split, huge packets might be dropped on their way. All applications I know of use UDP for rather small packets (as a rule of thumb I have in mind having read 1500 bytes max.).

    However, you are asking for a solution. Are you still in favor of the 2 port solution?

  12. #12
    Join Date
    Jul 2012
    Posts
    6

    Re: creating multiple ports at server and client

    Actually we want to send data through 10Gbps line(i.e. using optical fiber). So, to achieve higher data rates we have to send jumbo packets.Using single port we didn't get good throughput so we want go for 2 ports. Is there any solution for this ? ,otherwise please suggest a procedure to achieve good throughput.

  13. #13
    Join Date
    Nov 2002
    Location
    California
    Posts
    4,556

    Re: creating multiple ports at server and client

    Quote Originally Posted by bhanubtech35 View Post
    Actually we want to send data through 10Gbps line(i.e. using optical fiber). So, to achieve higher data rates we have to send jumbo packets.Using single port we didn't get good throughput so we want go for 2 ports. Is there any solution for this ? ,otherwise please suggest a procedure to achieve good throughput.
    If you are using UDP and Windows, your poor throughput with jumbo packets might be because of a known issue regarding the registry entries respectively called FastSendDatagramThreshold and FastCopyReceiveThreshold. The issue affects only Windows machines (naturally, since it's a registry entry) and not Linux etc. See, for example, these two links:

    "Server Does Not Use All Bandwidth Available When Streaming Files with Bit Rates over 100 Kbps" at http://support.microsoft.com/kb/235257

    "Microsoft Windows 2000 TCP/IP Implementation Details" at http://technet.microsoft.com/en-us/l.../bb726981.aspx (it's a long page, seach towards the end where you will find an explanation of the FastSendDatagramThreshold parameter)

    Try re-running your tests with different sizes for your message. Instead of 5000 bytes, try to re-run at the following message sizes:
    1023
    1024
    1025
    1026

    If you see a large slowdown in throughput as you change the message size from 1024 to 1025, then you are dealing with this known issue of registry entries.

    If so, then there is no need for multiple ports. Just change the registry entries.

    Mike

  14. #14
    Join Date
    Jul 2012
    Posts
    6

    Re: creating multiple ports at server and client

    we are using LINUX network programming

  15. #15
    Join Date
    Jul 2012
    Posts
    1

    Re: creating multiple ports at server and client

    Cycling is the most fashionable among all sports, not only because of its beautiful curve while riding across the road but also because of the diversified bicycle suits with which riders match their style at their will.You will find many excellent cycling jerseys from this site.

Page 1 of 2 12 LastLast

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

Featured