Thread: Help regarding Tcp/ip client server programming in C

  1. #1
    Registered User
    Join Date
    Oct 2007
    Posts
    22

    Help regarding Tcp/ip client server programming in C

    Hello Dear members,

    I am new to network programming in C. I am using Turbo C / visual studio IDE for C compilation. I have to do a program to connect to a mail server and retrieve data from the server.

    I tried in visual studio but got some error while linking somthing like _socket@12 not defined unresolved external.

    Please let me know how to do it in turbo c and how to make linking error free in visual studio sample code.... i am using window environment (windows 7)..

    Thanks in advance..
    Eagar to see some valuable knowledge
    Bhupesh

  2. #2
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    Eager to see your best effort first.
    1. Get rid of gets(). Never ever ever use it again. Replace it with fgets() and use that instead.
    2. Get rid of void main and replace it with int main(void) and return 0 at the end of the function.
    3. Get rid of conio.h and other antiquated DOS crap headers.
    4. Don't cast the return value of malloc, even if you always always always make sure that stdlib.h is included.

  3. #3
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    turbo c
    Why? Come join us in the 21st century. Cripes.

  4. #4
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    If you are using Turbo C because you have to, then you should ask the person who's set that restriction this question (eg, your professor) because no one actually uses Turbo C anymore, and if the prof wants you to use a specific tool nobody else uses in a course you have paid for, then the prof should teach you how to use the tool.

    http://en.wikipedia.org/wiki/Turbo_C

    Last version was released in 1992, meaning it is possibly older than you are.

    If you are using Turbo C out of choice, make a another one .
    Last edited by MK27; 03-27-2012 at 05:56 AM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  5. #5
    Registered User
    Join Date
    Mar 2011
    Posts
    546
    with visual studio C/C++, you have to add ws2_32.lib to the linker input to get the socket support.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help with client/server programming
    By csmatheng in forum C Programming
    Replies: 3
    Last Post: 10-10-2011, 09:46 AM
  2. Client server programming hijack
    By bhawna gopalka in forum Linux Programming
    Replies: 1
    Last Post: 10-07-2010, 05:18 AM
  3. C - Client Server game programming
    By git in forum C Programming
    Replies: 5
    Last Post: 09-06-2004, 02:09 PM
  4. help with sockets .. client-server programming
    By milan in forum Linux Programming
    Replies: 5
    Last Post: 01-05-2003, 06:47 AM
  5. Client/Server Programming!!!
    By Silverdream in forum C Programming
    Replies: 4
    Last Post: 03-30-2002, 12:19 AM