Thread: help me

  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    2

    help me

    i wish to create a terminal emulator using c language. instead of using serial cable as a medium, i would like to use nic, therefor sending data in the form of packets. how can i do this? can somebody help me?

  2. #2
    Registered User
    Join Date
    Mar 2003
    Location
    UK
    Posts
    170
    If 'nic' = network interface card ?
    Then communication using TCP is simple to do. The packet handling is done by TCP.

    These are the basic steps:
    To send - create a socket, connect, send to socket then close Socket.
    To receive - create a socket, listen on the socket then accept and receive
    in a loop.

    Lookup the following functions:

    winsock2.h

    // send program
    WSAStartup();
    inet_addr();
    gethostbyaddr();
    socket();
    connect();
    send();
    closesocket();
    WSACleanup();

    // receive program
    WSAStartup();
    socket();
    bind();
    listen();
    accept();
    recv();
    WSACleanup();

  3. #3
    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]

Popular pages Recent additions subscribe to a feed