Problem with Code ??

This is a discussion on Problem with Code ?? within the C Programming forums, part of the General Programming Boards category; Im trying to write a Simple Client and Server program.. But at this line.. Code: int S; struct sockaddr_in add; ...

  1. #1
    Registered User
    Join Date
    Dec 2010
    Location
    Lucknow, India
    Posts
    72

    Problem with Code ??

    Im trying to write a Simple Client and Server program..
    But at this line..
    Code:
     
    int S;
    struct sockaddr_in add;
    S = socket(AF_INET, SOCK_STREAM, 0);
    here i get the Following errors..
    "Undefined Structure 'sockaddr_in' in function main
    Size of 'add' is unknown or Zero in Function main
    undefined symbol 'AF_INET' in function main.
    undefined symbol 'SOCK_STREAM' in function main."
    Someone please Help me.
    Operating System: WINDOWS
    Compiler: Borland

  2. #2
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,403
    I know nothing of socket programming but perhaps you are simply missing a Header file here?, or a linking error, ie libraries are not linked or are not linked in correct order

    Code:
    struct sockaddr_in add;
    Is this supposed to be your structure definition?
    Thought for the day:
    "Are you sure your sanity chip is fully screwed in sir?" (Kryten)
    FLTK: "The most fun you can have with your clothes on."

    Stroustrup:
    "If I had thought of it and had some marketing sense every computer and just about any gadget would have had a little 'C++ Inside' sticker on it'"

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,337
    So this was all wasted effort then?
    how to send Email By C Program ??

    How many more times, from how many more people, will it take for you to get it into your head that your TURBO_CRAP compiler is DEAD.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  4. #4
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,403
    TURBO_CRAP compiler is DEAD.
    It has been great in its day, but it realy is amazing how often it pops up here still. Why are these (for the most part it seems Indian / sub continent) teaching institutes still advocating it's use??? It makes no sense, there is not even any economic justification as (FREE!)code blocks will run on even win 98 i think, and Dev C++ despite its dormancy will also, and even that is an improvement on the Turbo C. It would be most interesting to get some contact with one of the lecturers at these institutes, i bet they are taking private cash fees every one of them too.
    Thought for the day:
    "Are you sure your sanity chip is fully screwed in sir?" (Kryten)
    FLTK: "The most fun you can have with your clothes on."

    Stroustrup:
    "If I had thought of it and had some marketing sense every computer and just about any gadget would have had a little 'C++ Inside' sticker on it'"

  5. #5
    Registered User
    Join Date
    Dec 2010
    Location
    Lucknow, India
    Posts
    72
    Ok ok ok.. Salem.. I Promise that I stop using Borland compiler. Ok But you Please don't be Angry.
    Dude I installed Pelles C in my PC But Buddy the Problem is I dont know how to use it..???
    And the another problem is that everyone in my College is Using Borland or Turbo C So there is no one to Help me out if i get any Trouble with Pelles C..!!!
    :-(

    and rogster001 thanks for your Help.. now the problem is Resolved.
    Last edited by Gaurav Singh; 03-08-2011 at 11:45 AM.

  6. #6
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by Gaurav Singh View Post
    And the another problem is that everyone in my College is Using Borland or Turbo C So there is no one to Help me out if i get any Trouble with Pelles C..!!!
    Perhaps you should attend a College that exists in this millenium

    Pelles C maintains a help forum at ... Pelles C forum - Index

    It also has one of the best help files I've ever seen... Open the IDE... click Help -> Contents ... and start reading.

    Quote Originally Posted by rogster001 View Post
    It has been great in its day, but it realy is amazing how often it pops up here still. Why are these (for the most part it seems Indian / sub continent) teaching institutes still advocating it's use??? It makes no sense, there is not even any economic justification as (FREE!)code blocks will run on even win 98 i think, and Dev C++ despite its dormancy will also, and even that is an improvement on the Turbo C. It would be most interesting to get some contact with one of the lecturers at these institutes, i bet they are taking private cash fees every one of them too.
    Maybe they're still using Windows 3.1 too... Now that would massively suck!
    Last edited by CommonTater; 03-08-2011 at 02:51 PM.

  7. #7
    Banned
    Join Date
    May 2009
    Posts
    37
    Quote Originally Posted by CommonTater View Post
    Perhaps you should attend a College that exists in this millenium

    Pelles C maintains a help forum at ... Pelles C forum - Index

    It also has one of the best help files I've ever seen... Open the IDE... click Help -> Contents ... and start reading.



    Maybe they're still using Windows 3.1 too... Now that would massively suck!

    wow you really are what i predicted you to be.... "yeah.. well i picked this up too by myself and I CAN DO THIS...."

    C was not designed to only work in PC and mainframes, Dennis Ritchie -- that tech wiz, designed it as a very, very low abstraction for assembly so it can compile even on on embedded systems -- that's cellphones, routers, portable media players, set top boxes and more, moron if you're not familiar to the term.
    C++ took it a little too far by abstracting way too high even in it's core functionalities (that's without the "exceptions" support), inparticular, polymorphism -- in both static and dynamic levels, as they are done using tables of function pointers (if you don't know this lil bit, i'll ........ing fly to ontario where your house is probably half way buried in snow, so you've made it your life to proving your point).

    stop cheating logic by assuming half a dozen things about something so you can arrive on your preferred pity conclusion that serves you very "primal" brain.

  8. #8
    'Allo, 'Allo, Allo
    Join Date
    Apr 2008
    Posts
    611
    Quote Originally Posted by renzokuken01 View Post
    ...
    I like how you're so choked with rage that you can't even keep your sentences on track. Everybody take a good look, this is what happens when you're forced to use Turbo C in the real world.

  9. #9
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by adeyblue View Post
    I like how you're so choked with rage that you can't even keep your sentences on track. Everybody take a good look, this is what happens when you're forced to use Turbo C in the real world.
    Clearly, there are some mental health issues there...
    It's sad really 'cause you've got to be fairly intelligent to be that screwed up.

  10. #10
    Banned
    Join Date
    May 2009
    Posts
    37
    "yeah! yeah!! you gotta "pretty smart" if you can work with linked list stuff like that, huh??
    [pause....]

    pftt!!!! yeah, pretty smart for a ... [shakes head] he really doesn't get that working with nodes is very very normal in the programming world, right???

    Quote Originally Posted by adeyblue View Post
    I like how you're so choked with rage that you can't even keep your sentences on track. Everybody take a good look, this is what happens when you're forced to use Turbo C in the real world.
    i take it you just learned C online and is awfully proud of yourself, but don't know anything in computing science.
    Last edited by renzokuken01; 03-08-2011 at 09:54 PM.

  11. #11
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,337
    And so another troll hijack thread bites the dust.
    Last edited by Salem; 03-09-2011 at 04:43 AM. Reason: s/bytes/bites - lol
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem uder LINUX (gcc) and same code work at Windows (DevC++)
    By miroslavgojic in forum C Programming
    Replies: 5
    Last Post: 11-24-2010, 09:05 AM
  2. Problem with game code.
    By ajdspud in forum C++ Programming
    Replies: 5
    Last Post: 02-14-2006, 05:39 PM
  3. problem with selection code
    By DavidP in forum Game Programming
    Replies: 1
    Last Post: 06-14-2004, 01:05 PM
  4. Replies: 5
    Last Post: 12-03-2003, 04:47 PM
  5. Help with code for simple Y2K problem
    By Mule in forum C++ Programming
    Replies: 3
    Last Post: 03-05-2003, 11:53 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21