Jump to content
  • Advertisement

Lord Bart

Member
  • Content Count

    317
  • Joined

  • Last visited

Community Reputation

226 Neutral

About Lord Bart

  • Rank
    Member
  1. Lord Bart

    Select() problem

    Hello Talith, can't declear a int in the if. if(int sel = select(FD_SETSIZE, &cSet, NULL, NULL, NULL) < 0) need int outside if. int sel; if((sel = select(FD_SETSIZE, &cSet, NULL, NULL, NULL)) < 0) Lord Bart :)
  2. Lord Bart

    Select() problem

    Hello Talith, Decleared variables on the stack get what ever value was in the satck at that time, which could be complete garbage. Since timeval is a C struct it won't have a consturtor that set it to all 0. Do a memset on it if you want to wait until you get a connection, or pass a NULL for timeval in select. That should make it block untill it get a connection. Lord Bart :) [Edited by - Lord Bart on September 20, 2005 2:12:45 PM]
  3. Lord Bart

    Which version of C++ should I use?

    Yes MS is ANSI C/C++ compliant unless you are doing anything with Windows(GUI or system calls) and have code using ANSI defines then the compiler will break because none of the header files for Windows are ANSI compliant. Try it set compiler flag for strict ANSI and you will get thousands of error message in MS own headers. I VS 7 they use anonymous unions in the window header files which are not allow in ANSI C. Lord Bart :) [Edited by - Lord Bart on August 8, 2005 4:01:19 PM]
  4. If at all possible try to use reference argument to fill in a string or return a reference to a string if posible, but try to avoid return a string. void getSomeThing(string& fill); string& getSomeThingByRef(); // can change return string const string& getSomeThingByRefConst(); // can't change return string instead of: string getSomeThing(); // could invole 1 or more copies for strings Lord Bart :)
  5. Lord Bart

    address of an object in C++

    Yea you right Fruny, can't scope &. but new and delete you can. Lord Bart :)
  6. Lord Bart

    address of an object in C++

    Hello Nitage, I belive you can always get the reg(global) & operator by scoping it. obj* prt = ::& A; uses the global & not the classes. by putting :: before it you use the global & operator not the classes overloaded one. much like if you have a new overloaded class function you still want to use reg global new, you scope it ::new. Lord Bart :}
  7. Lord Bart

    Confusion over sockets - TCP and winsock

    Hello garyfletcher, Winsock 2 has almost the same calls as you would have on a UNIX box. Some of the prams might be NULL or 0 because winsock doesn't use then. One feature missing is poll but select is there. We mustly run on SUN and DEC but are starting to port some code over to Windows mostly client stuff with SUN as servers. And need to keep code the same as much as possible between the two. Winsock does add the abilty to do socket stuff by way of sending messages, like when you can send or have data to read, if you want to use it but your not force to use it. Lord bart :) [Edited by - Lord Bart on June 27, 2005 7:20:46 AM]
  8. Lord Bart

    Unreliable UDP packets

    Ok using Raknet, I never use it before. the recv buffer I am talking about is at the socket level. defualt on must systems is not large maybe 2 full size udp (128k) packets. Since udp is a datagram proto if the buffer is full system will throw away packet it can't store fully in the buffer. If you client is slow to pull data off the buffer with recvfrom(or what were Raknet uses call this at some point), then the buffer will fill up and message will be thorw away. If you use a port that is commonly use they you could be get udp packets form other programs coming to. Raknet should have control to yet you increase recv buffer of the socket. Also try to have your client do nothing but read packets as fast as it can. Of these 1,092 packets how big are they? The bigger they are the faster you recv buffer will fill up with data. size of MTU is just max size of smallest actual network packet you can send on the network. If you udp message is bigger (4000 bytes) system will break it apart into many MTU packets and send into 2 1400 and 1 1200. roughly Theres more of a chance to lose the data this way because if just one of the broken up (1400 byte) packets is lost the whole udp message is disgraded. Thats why UDP is unreliable. Lord Bart :)
  9. Lord Bart

    Unreliable UDP packets

    Hello TalonSnow, First what network library and on what system are you running on? Stright socket lib doesn't have reliable udp. If running on same system udp(or tcp) never goes to network it handle local on system by ways of pipes/internal buffer/files etc control and set up by system. If sending lots of udp message it your recv buffer is small any packet sent after it is full are thrown away, by nature of UDP. More info would be nice. Lord Bart :)
  10. Lord Bart

    Is this legal in Standard C++ ?

    Hello neverland, Yes both are valid functions. They will get name mangling by compiler into 2 different name functions. If you were creating a lib these should be in it. example: readable name => expanded compiler name mangling void foo() => foo_v void foo(int i=0) => foo_si Both can be compile into obj files. The problem you have is when you try to use the function the compiler doesn't know which one to expand out as a function name if no argument given. Which one should it use? foo() or foo(0). It is a bad thing to do to give a compiler such a choice. I would make the int one not have a default value. Lord Bart :)
  11. Lord Bart

    Using classes in other classes

    Don't need the class in front of Log in MainSub. class MainSub { MainSub(Log &l) : log(l) {} // I made a typo error here ; should have been {} // sorry Log &log; }; Also you can't initialize a data member at declaration. Try this: class Main { Main() : MainSub(this->log) {} Log log; MainSub MainSub; }; The problem is you want at initialize MainSub with log that comes form Main. Since Log is decleared first in Main it will be initialize first. Then you should be able to pass log to MainSub. Lord Bart :) [Edited by - Lord Bart on June 16, 2005 2:43:39 PM]
  12. Lord Bart

    Using classes in other classes

    Hello twan, If log is global or is file scope you can just have a log class use. global: extern class Log; define some were else or in this file just don't put extern. file scope: static class log; only seen in this file and init before running. Does it need to have log as a data member: class MainSub { ... class Log log; ... }; If you want MainSub to have an instance that reference a class log. Then you can use a pointer to log class or a refernece. class MainSub { MainSub(Log* l) : log(l) ... class Log* log; ... }; or class MainSub { MainSub(Log& l) : log(l) ... class Log& log; ... }; Is log meant to be globaly used? Lord Bart :)
  13. Lord Bart

    master's degree or 5 years industry experience [rant]

    Hello sunandshadow, Like Mawr said teaching at a shool is a little different. Schools like to show how many masters, and Phds they have. Don't gave up though, try to get a job doing software, even non game related, best in graphical or networking is a plus or simulation. 4 years plus one of genral software should make 5 years industry exp. Good luck. Lord Bart :)
  14. Lord Bart

    headers

    Is the path to MathHdr.h in the compile line do you see -I with the path were it lives, eats and sleeps. Lord Bart :)
  15. Lord Bart

    headers

    Hello stroma, you mean you did this #ifndef _MATHHDR_H_ #define _MATHHDR_H_ #incldue <vecotr> etc ... #endif /* to end the ifndef _MATHHDR_H_ code*/ you should be able to include this anywere. You aren't defining _MATHHDR_H_ somewere else are you?
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!