Thread: Socket (kinda) help...

  1. #1
    ------------
    Join Date
    Jun 2005
    Posts
    79

    Send... please help...

    Ok, i made a MUD server (it actualy connects!) but cant figure out how to make it send text to the person connected to it... i tried using

    Code:
    Send("text");
    and it keeps saying that it doesnt know that command... i looked at code from
    other MUD codebases and just cant figure it out... some of them had like
    Code:
    player -> Send("text";
    but i dont know how to set something like that up... im still kind of new to C++ BTW, im using a MUD codebase as a learning experience (i know its not the easiest to learn with, but i think i can handle it....)
    Last edited by Goosie; 07-04-2005 at 09:32 PM. Reason: changing title...
    CAUTION: Newbie at programming!
    -------------------------------------------------
    Thanks everyone who helped me with all the questions, and utter lost-ness i happen to have... it is VERY VERY much appreciated

  2. #2
    ------------
    Join Date
    Jun 2005
    Posts
    79
    ok, using cout or fsprintf or sprintf dont work either... and i'm still looking through code and seing the same code again... and im trying to find were the wrote how to send it and still cant find that either. it would be nice to know how this is supposed to work so i can start working on loading/saving characters... any help would be appreciated
    CAUTION: Newbie at programming!
    -------------------------------------------------
    Thanks everyone who helped me with all the questions, and utter lost-ness i happen to have... it is VERY VERY much appreciated

  3. #3
    ------------
    Join Date
    Jun 2005
    Posts
    79
    sorry for being a bother about this but ive been trying to get this to work for 2 days now... currently my MUD will only connect, nothing else... it connects and sits there doing nothing... ive been though 3 searches (and went through every single post) and went through google.com and google.com/linux (figured i might get an answer...) looking for something and theres nothing... Im starting to wounder if C++ even uses send() so if it doesnt can someone please tell me its alternative or how to set something up with it... i had got an error once using send() and it just said there werent enough args, so i added 1 more and it said there was too many... and i changed it and now cant even get that error back... basically what im asking this time is does send() work with C++ or are all the muds im seing with it writing their own somewere (ive looked through the codes too...) that im missing? and if their writing their own can someone help me by giving me an idea on how to write one? again, im sorry for the annoyance but i really really need this or there is no point in me trying to code any more of my MUD...
    CAUTION: Newbie at programming!
    -------------------------------------------------
    Thanks everyone who helped me with all the questions, and utter lost-ness i happen to have... it is VERY VERY much appreciated

  4. #4
    Banned
    Join Date
    Jun 2005
    Posts
    594
    I guess noone that visit here know alot about sockets, you
    should of possible posted this in the networking section
    of this forum.

    Id love to help you but sockets are on my todo list still.

  5. #5
    ------------
    Join Date
    Jun 2005
    Posts
    79
    :-/ i didnt think of posting it there... figured im writing in C++ and this is the C++ part of the forum... dang... i had started of thinking about switching to C, then looked at a C codebase and didnt like it so that kept me on C++...

    ::sigh::

    oh well, i guess if nobody can help me here then i'll have to figure it out by myself... im sure ill get it, eventualy...
    CAUTION: Newbie at programming!
    -------------------------------------------------
    Thanks everyone who helped me with all the questions, and utter lost-ness i happen to have... it is VERY VERY much appreciated

  6. #6
    Deprecated Dae's Avatar
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    1,034
    So many new programmers get caught up trying to make a game (usually MUD) using code they dont even know how to use, which ends up just wasting their time and barely teaching them anything. My honest advice is to stop, and wait until you know more C++ (and read a tutorial on sockets) before adding to the game.

    Thats probably not what you want to hear though. Yes Send() is a function from the MFC library: http://msdn.microsoft.com/library/de....3a3a.send.asp, but you're going to need to know more functions from there and how to use them in your own functions which is what an MFC Socket tutorial is for, and you will need a good C++ grasp to do most efficient things with libraries (mfc is windows only btw).

    So yeah if you're going to continue pushing yourself down a path that probably wont teach you much and lands you a half-ass program, then like the other poster said, you should go ask in the Networking forum if you have anymore troubles.
    Warning: Have doubt in anything I post.

    GCC 4.5, Boost 1.40, Code::Blocks 8.02, Ubuntu 9.10 010001000110000101100101

  7. #7
    I am me, who else?
    Join Date
    Oct 2002
    Posts
    250
    That is true, socket programming is not incredibly difficult, but a good understanding of all the basics is absolutely required. I've written several socketed programs and know that it take s agood undertsnading of fundamentals before you try some.

    If you are using MUD code, you might want to check the code thoroughly to see examples of how they send things. MUD code is "advanced" in the sense that it is refined and streamlined code which unless you took a lot of time developing MUD code, it would take quite a while to reverse engineer it, or make sense of it.

  8. #8
    C++ Beginner
    Join Date
    Jun 2005
    Posts
    39
    goosie do you have aim or something? I'm really trying to make something like a mud server but i don't have a clue on sockets! Can someone point me in the right direction or something ><.

  9. #9
    *this
    Join Date
    Mar 2005
    Posts
    498
    Go to the network programming forum and ask there. they have tons of great tuts

  10. #10
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    There is a winsock function called send, but the function you referred to from some codebase was part of a class. You'd have to look at the function definitions in the class to know what's going on there...

    In any case, if you want to do this you should probably check out the network programming board (there should be a sticky there with some useful links)

    Edit: And I kind of think this is a bit much to be working on if you don't have much C++ experience, but failure is the first step to success, after all...
    Last edited by JaWiB; 07-05-2005 at 06:41 PM.
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  11. #11
    ------------
    Join Date
    Jun 2005
    Posts
    79
    yea, im starting to figure it is a little over my head for right now... so i deleted what i did (that way i wount go straight back to trying to work on it... i have a habit of not leaving stuff un-finished...) and now im going to finish up these tutorials on this website and try again after i learn a lot more C++. thanks for the help everyone...

    and sorry for taking so long to respond to these, ive been out of town for a little bit, and renegade my AIM is DrkCyron if you still want it
    CAUTION: Newbie at programming!
    -------------------------------------------------
    Thanks everyone who helped me with all the questions, and utter lost-ness i happen to have... it is VERY VERY much appreciated

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Non-blocking socket connection problem
    By cbalu in forum Linux Programming
    Replies: 25
    Last Post: 06-03-2009, 02:15 AM
  2. socket programming question, closing sockets...
    By ursula in forum Networking/Device Communication
    Replies: 2
    Last Post: 05-31-2009, 05:17 PM
  3. socket programming in linux
    By crazeinc in forum C Programming
    Replies: 1
    Last Post: 05-27-2005, 07:40 PM
  4. when to close a socket
    By Wisefool in forum Networking/Device Communication
    Replies: 5
    Last Post: 11-02-2003, 10:33 AM
  5. socket newbie, losing a few chars from server to client
    By registering in forum Linux Programming
    Replies: 2
    Last Post: 06-07-2003, 11:48 AM