Thread: Streams And Sockets?

  1. #1
    Registered User
    Join Date
    Feb 2003
    Posts
    265

    Streams And Sockets?

    Ok, how is everybody doing sockets these days. Im still back in the stone age printf'ing into a buffer, and sending the buffer. Is it possible in this great new day and age to use streams to do socket io? like mystream << mysocket, or std::getline(mysocket,mystring,widen('\n'));? If anybody has a better way to do socket io using winsucks...erm... winSOCKS, im deffinetly interested in finding a better way than old sprintf(mybuff, "somestuff\r\n"); send(mysock,mybuff,strlen(mybuf),0);

    Thanks for your time.

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Sounds like this should be in the networking forum... moving.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  3. #3
    Registered User
    Join Date
    Feb 2003
    Posts
    265
    Its more of a C++ question than a networking question, i have no problems with the networking, its the streams im curious about.

  4. #4
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    Well, you could always overload the << and >> operators for your socket wrapper class (i.e. Socket ) and for the stream... dunno how much effort that would save though.
    Just Google It. √

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

  5. #5
    Registered User
    Join Date
    Feb 2003
    Posts
    265
    =P the streams are for a seperate project. more a question of compadibility than anything else.

  6. #6
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,490
    The flashchat program I posted a week ago on this forum uses sockets like that.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Peeking at streams
    By Achy in forum C Programming
    Replies: 13
    Last Post: 06-12-2006, 02:46 AM
  2. Problem with streams and sockets
    By Crazy Glue in forum C# Programming
    Replies: 1
    Last Post: 05-28-2006, 04:26 PM