Socket Programming

This is a discussion on Socket Programming within the C++ Programming forums, part of the General Programming Boards category; Hi, I am very new to VC and I land myself in a catch 22 situation... here's what I have ...

  1. #1
    Registered User
    Join Date
    Sep 2002
    Posts
    10

    Unhappy Socket Programming

    Hi,
    I am very new to VC and I land myself in a catch 22 situation...
    here's what I have to do...

    1) Connect to a server using a SPECIFIED port and an IP
    2) If the server sends -1 then it's an error
    else
    its a success..

    Thats all!!
    How and what do I use for this...
    I'd appreciate if you can help me out with either the code
    or specify any link to take the sample from..

    Please HELP!!!!
    Regards,
    John

  2. #2
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    I recommend Network Programming for Microsoft Windows, Second Edition by Anthony Jones and Jim Ohmund.

    Kuphryn

  3. #3
    Registered User
    Join Date
    Aug 2002
    Posts
    170
    not to be simplistic here but....

    Code:
    if( // your code// != -1)
    {
        // Insert your success code here.
    }
    else
    {
       // Insert your failure code here.
    }
    Best Regards,

    Bonkey

  4. #4
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    I think he's asking for functions.

    socket() creates a socket, connect() allows you to connect that socket to a server. either one of those failing is a bad thing obviously and would give you an oportunity to return -1.



    if that's what you're asking.
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  5. #5
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    Look up WSASend(), WSARecv(), etc. at MSDN. I recommend a book on networking program for Windows. You will need to analyze differnt I/O models.

    Kuphryn

  6. #6
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    >>How and what do I use for this...
    Try a tutorial...!
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  7. #7
    Registered User
    Join Date
    Oct 2001
    Posts
    104
    Ilia Yordanov,
    http://www.cpp-home.com ; C++ Resources

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. socket programming question, closing sockets...
    By ursula in forum Networking/Device Communication
    Replies: 2
    Last Post: 05-31-2009, 05:17 PM
  2. Socket Help - Multiple Clients
    By project95talon in forum C Programming
    Replies: 5
    Last Post: 11-17-2005, 01:51 AM
  3. when to close a socket
    By Wisefool in forum Networking/Device Communication
    Replies: 5
    Last Post: 11-02-2003, 09:33 AM
  4. problem closing socket
    By Wisefool in forum Networking/Device Communication
    Replies: 2
    Last Post: 10-29-2003, 11:19 AM
  5. socket newbie, losing a few chars from server to client
    By registering in forum Linux Programming
    Replies: 2
    Last Post: 06-07-2003, 11:48 AM

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