Thread: Can some one help me with a stocket example, please?

  1. #1
    Registered User
    Join Date
    Dec 2005
    Posts
    155

    Can some one help me with a sockets example, please?

    Hi, I been trying to learn stocket programming for a while (lol, like half a year) and still really havent understand what goes into a cilent and server code.

    I was wounding if someone could make me a example of the 2 sides; also I was wounding how to send data over to the server side and back, like a messager. Mostly just looking for examples - source code. I learn better that way.

    Trying to do this in C++ using windows, Dev-C++ complier.
    Last edited by adr; 09-30-2007 at 01:52 PM.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Have you read "beej" yet?
    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.

  3. #3
    Registered User
    Join Date
    Dec 2005
    Posts
    155
    Actully I have, it help me understand what the code does and how it works, I just cant seem to get the socket to work all togather in the codes for each side. Another reason why I would like examples to see how all togather how it works- but like a simplier version of it.
    Last edited by adr; 09-30-2007 at 03:24 PM.

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    I thought the one in beej was about as simple as it was possible to get.
    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.

  5. #5
    Registered User
    Join Date
    Dec 2005
    Posts
    155
    Quote Originally Posted by Salem View Post
    I thought the one in beej was about as simple as it was possible to get.
    Yea it is, dont get me wrong, thats how I know what most of the commands lines do and work, but see, I dont really get the flow on how it works. + I learn better playing with something all ready made then having to make it if that makes sense? Kinda like a idea on how its going to work. Beej does try this with examples in c, witch is good, but I get lost reading it half the time.

  6. #6
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Throw some printf() statements in there, and watch what happens.
    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.

  7. #7
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    If you get lost half the time, then read it twice that way you won't get lost at all.

    You're going to have a hard time with future concepts if you can't follow tutorials. It's not really learning if you have the finished product, because you don't *actually* understand what's going on. It's like if you had a car motor for example, sure you'd be able to fix it without knowing much about motors, but without learning about the motor in depth it'd be impossible to build your own.

  8. #8
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    I can break almost anything with little or no knowledge
    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.

  9. #9
    Registered User
    Join Date
    Dec 2005
    Posts
    155
    Quote Originally Posted by zacs7 View Post
    If you get lost half the time, then read it twice that way you won't get lost at all.

    You're going to have a hard time with future concepts if you can't follow tutorials. It's not really learning if you have the finished product, because you don't *actually* understand what's going on. It's like if you had a car motor for example, sure you'd be able to fix it without knowing much about motors, but without learning about the motor in depth it'd be impossible to build your own.
    I can follow tutorials, its how I learn c++ from little programs/test like on this site and others, I just dont understand the flow with their examples really. (hard to example sorry-)

    And as for the finished product, yes your right, you wont really learn from having the finish product if you dont even get whats going on in the program but I want to use it for more reference to what they talk about then actully to learn out of no where on. Like "lisen on port whatever" then I can look at the code example and be like oh thats it, then find how that code works by looking around or links that it goes to; like for example "a = b;", so you want to know what "a" and "b" could be "int a;" "int b;" so most likey "a" and "b" is a number or some bad input.

    The motor example kinda doesnt go to good with me XD lol, I would proablly be turning that motor inside out figuring how it works and why then make it into a generator (witch I kinda did).

Popular pages Recent additions subscribe to a feed