Thread: tcp/ip communication via console

  1. #1
    Registered User
    Join Date
    Dec 2002
    Posts
    221

    tcp/ip communication via console

    basically, i just wanna get started on socket programming and i wanna make a server program that listens on a port and recives messages send from a client program jusrt made to send messages. i dont think this should be too hard

    now, i need to know where to start. correct me if im wrong, but winsock.h and winsock2.h are both used for windows api, right?
    if thats true, then i dont know if i can use them in a console based program.

    where would be a good start to read about this and what include files would i need?
    im using dev c++

    BTW, if anyone things borland or microsoft c++ woudl be better for this, lemme know

  2. #2
    Funniest man in this seat minesweeper's Avatar
    Join Date
    Mar 2002
    Posts
    798
    Beej's is a good place to start.

  3. #3
    Registered User
    Join Date
    Dec 2002
    Posts
    221
    curious asto how hard is this project?

  4. #4
    Funniest man in this seat minesweeper's Avatar
    Join Date
    Mar 2002
    Posts
    798
    Not that hard at all. That page I gave you will take you through all the steps you need to get a simple server-client system running. And of course there are plenty of people here to help you when you get stuck

  5. #5
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    Its hard to suggest what compiler is better for what person under any circumstance, but i perfer Microsoft VC++ 6.0 or .NET.

    As for good places to start, here are some hits from google. Happy coding!

    Clicky

  6. #6
    Registered User
    Join Date
    Dec 2002
    Posts
    221
    going back to my compiler question
    im using dev c++ and i cant even get this part of the code to work

    Code:
    #include <iostream.h>
    #include <iomanip.h>
    #include <stdlib.h>
    #include <winsock.h>
    #include <stdio.h>
    //#include <winsock2.h>
    
    using namespace std;
    
    int main()
    {
        WSADATA wsaData;   // if this doesn't work
        //WSAData wsaData; // then try this instead
    
        if (WSAStartup(MAKEWORD(1, 1), &wsaData) != 0)
        {
            fprintf(stderr, "WSAStartup failed.\n");
            exit(1);
        }
        system("PAUSE");
        return 0;
    }
    and if i try to include winsock2.h, it gives me an error saying unbalanced ifndef or something

  7. #7
    Registered User
    Join Date
    Dec 2002
    Posts
    221
    must read!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Full Screen Console
    By St0rmTroop3er in forum C++ Programming
    Replies: 1
    Last Post: 09-26-2005, 10:59 PM
  2. basic tcp/ip communication
    By kimusabi_1 in forum Networking/Device Communication
    Replies: 2
    Last Post: 04-04-2005, 07:25 PM
  3. Problems with a simple console game
    By DZeek in forum C++ Programming
    Replies: 9
    Last Post: 03-06-2005, 02:02 PM
  4. Console Functions Help
    By Artist_of_dream in forum C++ Programming
    Replies: 9
    Last Post: 12-04-2004, 03:44 AM
  5. Just one Question?
    By Irish-Slasher in forum C++ Programming
    Replies: 6
    Last Post: 02-12-2002, 10:19 AM
Website Security Test