opening a port?
Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: opening a port?

  1. #1
    Junior Member
    Join Date
    Jul 2004
    Posts
    19

    opening a port?

    Does anybody know how I can open a port in a C++ command line program?If so please help me I am in diar need!

  2. #2
    Senior Member
    Join Date
    Oct 2002
    Posts
    4,055
    It depends what port (although in command line applications, I'm sure your limited). Can I ask why you need it so bad, as you say you are in "diar need"?
    Space For Rent.. =]

  3. #3
    Banned
    Join Date
    Aug 2004
    Posts
    95
    You need to create sockets and have data accepted through it and a wide variety of things... I've never done it in C++ but have in Java... you need the socket.h header from what I found (http://www.adp-gmbh.ch/win/misc/sockets.html).

    [edit]
    Typo.

  4. #4
    Junior Member
    Join Date
    Jul 2004
    Posts
    19
    My friends and I are trying to write this program in which we open each others ip addresses to view programs so we can share files. We felt like a challange. I promised I would write the part to where it will open the port in which we would use. I don't want to disappoint them, because I promised.

  5. #5
    Elite Hacker
    Join Date
    Mar 2003
    Posts
    1,407
    I would say your best bet is to find some sample code and work from that. I don't know about C++, but in C sockets seem to be sort of complicated. I want to try and learn them so I'm going to do what I just suggested you do. Getting bits of code and messing with them. If you mess with them long enough the info just sticks and you can pretty much write the code from scratch. Good luck. Peace.

  6. #6
    Custom User
    Join Date
    Oct 2001
    Posts
    503
    The good thing about C++ would be that you could write up your own class (assuming one didn't already exist) to encapsulate all the annoying socket code so that you didn't have to remember it all.

    ac

  7. #7
    Elite Hacker
    Join Date
    Mar 2003
    Posts
    1,407
    Originally posted here by gothic_type
    The good thing about C++ would be that you could write up your own class (assuming one didn't already exist) to encapsulate all the annoying socket code so that you didn't have to remember it all.

    ac
    Make a tut on it . Can you do the same thing with C? There is no doubt with java, but I'm starting C and I want to do some leet codez.

  8. #8
    Banned
    Join Date
    Jun 2003
    Posts
    1,302
    ZC anything you can do in C++ you pretty much can do with C. I have some code around somewhere on programming sockets in C and C++.

    Of Course I am going to have to give my normal statement. PRogramming sockets in perl, isn't that hard.

  9. #9
    Elite Hacker
    Join Date
    Mar 2003
    Posts
    1,407
    It's easy in java. I want to learn in C though :P. I've been skimming a .chm on unix socket programming in C, and it seems kind of complicated. I was actually skimming it before my history quiz instead of my history stuff. That might have been a mistake. Looks like it might take me a while to get the concept down. Maybe if I read the chm instead of skimming it something will stick. Or maybe I just need a better reference . The book for my class mentions having some code for a simple UNIX shell. I want to take a look at that. Sounds interesting. Peace and perl sucks (j/k).

  10. #10
    Banned
    Join Date
    Jun 2003
    Posts
    1,302
    ZC, don't make me slap you. I will put the C scripts that I Have in my home directory and name then C-****. Take a look at them whenever you get a chance. I looked in the book, I got them from, and they are for a Connection server and client.

    Perl pwns Java any day.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •