Results 1 to 2 of 2

Thread: [C++] Create socket o internet

  1. #1
    Join Date
    Apr 2013
    Beans
    2

    [C++] Create socket o internet

    [FONT=Ubuntu] hi to all!!
    i'm trying to realize a simple server (and therefore also a client) with sockets..
    i've been realized a simple server with the AF_UNIX's family sockets..but now i want to implement a server with the AF_INET's family socket..
    to help me i have found this useful giude http://www.linuxhowtos.org/C_C++/socket.htm.. my problem is that i want to upload the socket on internet (to whatever site) to have an absolute address and let that way to clients to connect without problems to socket present on web..
    is it possible?..if not, can you link me some guides or tell me what to do?..
    tank you!!

  2. #2
    Join Date
    Jun 2007
    Location
    Maryland, US
    Beans
    6,288
    Distro
    Kubuntu

    Re: [C++] Create socket o internet

    You can use any ephemeral (available) port on your system for your server. If your system sits behind a firewall, then you need to make sure that a client system can connect through the firewall to your server computer.

    Before embarking on this (web) internet endeavor, let me suggest that you attempt to develop both a client and a server that runs on your local system. Your server should use an ephemeral port, and bind the socket to all of your system's interfaces, or just the main network interface (usually the IP address returned by ifconfig eth0).

    You should then be able to run your client and server on different systems, or alternatively on the same system, within your local area network. If you wish for a peer to connect to your server from outside of your LAN, then you will need to give that person two pieces of information: 1) the IP address of your server, and 2) the port to connect to. (Keep in mind that you will have to manage your firewall to allow traffic through that port!).

    If you require additional information, here's the best guide that I have come across: http://beej.us/guide/bgnet/output/ht...age/bgnet.html
    Last edited by dwhitney67; September 16th, 2013 at 10:12 PM.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •