Best API for Network/Internet Communication

This is a discussion on Best API for Network/Internet Communication within the Networking/Device Communication forums, part of the General Programming Boards category; Hullo hullo, I was just wondering if there are any other recommended APIs out there other than Winsock for communication ...

  1. #1
    Epo
    Epo is offline
    Registered User
    Join Date
    Jun 2003
    Posts
    361

    Best API for Network/Internet Communication

    Hullo hullo,

    I was just wondering if there are any other recommended APIs out there other than Winsock for communication between computers. (I'm sure there are, but are there any that are more flexible to use?)

    My project will require many simultaneous transfers of large amounts of data, and this is just something that my previous method of attack could not handle.

    Which kind of makes me question whether or not Winsock is the BitBlt of communication. Any thoughts are appreciated. Complexity won't be an issue (well, eventually anyways, if it's worth it, I'll take the time to learn it).

    Thanks,
    Erik

  2. #2
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,246
    As far as I know, the only alternative to winsock is the Cygwin POSIX socket implementation. From a programming point of view though, this will be almost identical to using winsock. The main difference is the POSIX version allows you to do read(), write(), and close() calls on socket file descripters.

    One alternative for you might be to use a library which includes a wrapper for winsock. Examples would be SDL or MFC. Maybe I could give more help if you were more specific in your needs.

    My project will require many simultaneous transfers of large amounts of data
    Winsock handles this just fine.

  3. #3
    Epo
    Epo is offline
    Registered User
    Join Date
    Jun 2003
    Posts
    361
    Hmm, maybe I'm blaming the wrong part of the program then...

    I was using an array of Winsocks to send/receive messages, and every now and then files too. When two files were being transferred at the same time, the one that began first would halt until the second one finished, and then it would resume once the second finished.

    I just kind of assumed that Multi-Threading and Winsock didn't like eachother. Or is this just a multi-threading problem in its own? (Seperate from Winsock)

  4. #4
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,246
    Are you writing a server, or a client that connects to multiple servers? If you are writing a server, then there is not need to have an array of anything.

    If you have a multithreaded program, windows will automatically context switch between the different threads. If you have two different threads that are sending a file, windows will switch back and forth between them. The kind of behavior you described would only happen if one thread was blocking for some reason, or if the thread sent the file fast enough that it could do it without a context switch.

    Even if you do not explicitly break the data you are sending into smaller packets, the underlying winsock code will do it for you. data will be broken up into packets based upon your computer's MTU (about 1600 bytes). After it sends a packet, the OS is free to context switch to another thread.

    I just kind of assumed that Multi-Threading and Winsock didn't like eachother
    On the contrary, winsock has no problems with multi-threaded programs assuming it's being done correctly. Now if you are using the same socket descriptor in different threads, that could cause you problems.

  5. #5
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    Posts
    768
    off the topic, the Ethernet MTU size is 1500,
    1600 is for Frame Relay
    "I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe

    http://www.Bloodware.net - Developing free software for the community.

  6. #6
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    I've heard that DirectPlay is used for networking games, though I know little else about it... there's something about chatroom functionality built into it too, I think.

    For the most part though, all I've heard of being used for networking is WinSock though (and libraries that wrap around it).
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  7. #7
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,246
    off the topic, the Ethernet MTU size is 1500
    Oops, my mistake. It is indeed 1500

    I've heard that DirectPlay is used for networking games
    DirectPlay is just a winsock implementation. Its probably more complex than just a simple wrapper, but in the end - it still uses winsock

  8. #8
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    Cool, I suspected as much but wasn't too sure.
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  9. #9
    Epo
    Epo is offline
    Registered User
    Join Date
    Jun 2003
    Posts
    361
    Winsock it is.

    Thanks for the info guys

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Unkown Hang
    By Bladactania in forum C Programming
    Replies: 31
    Last Post: 04-22-2009, 09:33 AM
  2. FILES in WinAPI
    By Garfield in forum Windows Programming
    Replies: 46
    Last Post: 10-02-2003, 06:51 PM
  3. OLE Clipboard :: Win32 API vs. MFC
    By kuphryn in forum Windows Programming
    Replies: 3
    Last Post: 08-11-2002, 05:57 PM
  4. Is it foolish to program with Win32 API ?
    By Kelvin in forum Windows Programming
    Replies: 2
    Last Post: 07-09-2002, 02:03 PM
  5. pthread api vs win32 thread api
    By Unregistered in forum Windows Programming
    Replies: 1
    Last Post: 11-20-2001, 07:55 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21