C++ Socket

This is a discussion on C++ Socket within the C++ Programming forums, part of the General Programming Boards category; Hello, 1) I am wondering if you could show me little example writing a socket in c++ for UNIX. Write ...

  1. #1
    Ice_Black
    Guest

    C++ Socket

    Hello,

    1)

    I am wondering if you could show me little example writing a socket in c++ for UNIX.

    Write a quick program that will receive data html from google.com

    Example:

    Enter a URL: google.com

    Output: <html><head><meta http-equiv="content-type" content="text/html; charset . ... .. .
    ... ...
    .......
    .
    </html>


    This will output the data... :P


    ------------

    2) Do you know where I can get a totorial/example for c++ socket for UNIX.

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

  3. #3
    Ice_Black
    Guest
    Originally posted by Hammer
    http://www.ecst.csuchico.edu/~beej/guide/net/

    Yeh I know this link but exame code from this link is C

  4. #4
    Registered User
    Join Date
    Oct 2002
    Posts
    291

  5. #5
    Ice_Black
    Guest
    Originally posted by laasunde
    http://www.hal-pc.org/~johnnie2/winsock.html

    http://energon.home.mindspring.com/t..._tutorial.html

    The above links should get you started.
    This is for windows programming. I want it for Unix :P

  6. #6
    Xei
    Xei is offline
    Registered User Xei's Avatar
    Join Date
    May 2002
    Posts
    719
    The programming for windows and Unix sockets is very similar, they are both based on the interface/sytax standard set by Berkeley. So once you study Windows Sockets you probably wont have much trouble in Unix because you'll notice the same commands with the same syntax and both will still use the IPv6 format.

  7. #7
    Registered User
    Join Date
    Nov 2002
    Posts
    491
    sockets are not part of any langauge standard, thusly it is the same in coding them in C/C++.

  8. #8
    Registered User
    Join Date
    Oct 2002
    Posts
    291
    Originally posted by Ice_Black
    This is for windows programming. I want it for Unix :P
    In Windows you need to run WSAStartup() and WSACleanup(); otherwise it should be the same for Windows and Linux/Unix.

    Did you actually bother to read any of the tutorials ?
    Im not sure about the difference between linux and Unix but in the first paragraph of one of the tutorials it says :
    "I'll be writing this tutorial from the point of view of a Windows user just for the sake of explaininglarge chunks of code that the WinSock authors felt were needed... I'll explain, throughout and at the end, how to get things working in Linux"

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