Jump to content
  • Advertisement

XaserIII

Member
  • Content Count

    25
  • Joined

  • Last visited

Community Reputation

102 Neutral

About XaserIII

  • Rank
    Member
  1. yea right... actually a little unprecise by MSDN, saying that recv only returns zero if the socket was closed... Well anyway, works now Greetz, Xaser
  2. Well eventually I managed to fix the problem myself. Basically it had to do with my "Ultra Dynamic Packet Handling" which hat one corrupt line which actually always led to the situation that the recv acutally expected to recv 0 bytes. Well thanks anyway^^ Greetz Xaser
  3. yes exactly and they are identical to the sent ones. Also I guess if it wasn't successfull, the socket would not have been closed gracefully and WSAGetLastError would not have returned zero. Xaser
  4. Quite interesting, as I said the client itself is not closing the connection, indeed it doesn't even seem to know that the socket has been closed as it proceedes normally untill the next send / recv call. on both sides returns zero. Thats why I said the connection is closed gracefully. Greetz Xaser
  5. Well, As I said the packet is sent as one "chunk" with one send call completely by my client application but then recieved by my server application in three steps, three recv calls to distinguish between packet types. First it recieves the opcode, then it recieves the size of the actual packet data which is going to income to find out when the next package starts and then the data arrives which has exactly the size which was sent before. So the first two recv calls work, also the third one recvieves what it should to, so it can be called a successfull call, but as the socket is then automatically closed and recv actually returns 0 even though all bytes were recieved its somehow gone wrong. And I just don't see why the socket is beeing closed then, even though everything seemed to have worked fine. Greetz, Xaser
  6. Hi! I'm currently working on a little socket programm, everything worked fine so far, but now I'm facing a problem I can't find any solution to. Maybe you can help me. The Problem is, that the socket ist automatically closed after the very first packet ist completely sent by the client and recieved by the server. The Packet is sent in one step but recieved in three step. OPCODE, Data size, Data. Every recv call is successfull (with MSG_WAITALL) but the last one (the data one) returns 0 wich means connection gracefully closed (which I didn't do in my own code, it happens by some side effect). Do you have any idea what the problem could be? Xaser
  7. XaserIII

    When use what Error-Handling

    Hmm.. interesting^^ But still couldn't convince me fully. You are right in many points, but also wrong in some others. For Example about the try / catch blocks in loads of places, true but it still divides perfect running code and exception handling clearly and I would say it is about the same effort than endless long if blocks checking what return code is given back etc. Xaser
  8. XaserIII

    When use what Error-Handling

    Ah okay yea I think I was to much in C# there.. ^^ Thanks, Xaser
  9. XaserIII

    When use what Error-Handling

    Well Thanks for all the opinions, even though I'd like to know on what you based this one. I have decided to deal with it like Blutzeit said. If the unexpected behaviour is non critical for the function or even could be expected somehow I will use ifs. I however I got the problem that a negative function call will indicate me that something critical is wrong, which will influence the whole algorithm then I think exceptions are the better choice. Thanks, Xaser ADIT: In C++, throw by value and catch by const reference. You don't want to deal with ownership problems when handling an exception. [/quote] So just throw 5 or what? why?? what problems could occur?
  10. XaserIII

    When use what Error-Handling

    Well thanks, I guess exceptions are better in my case, as they can carry much more information and distinguishing between error codes etc will just fill the code and make it less readable. Xaser
  11. XaserIII

    When use what Error-Handling

    Well its a general problem, for debugging as well as for the release. The release version will have to be able to handle such problems as well. Both ways do their job and I for myself can't really tell what has more advantages in what situation, thats why I'm asking. Xaser
  12. Hi! I'm still programming my little game and just wondered how to best deal with unexpected behaviour, i.e. when something fails that should work. Well the short term to describe this is Exception Handling, but when should I use what method? For example, if I expect my Func1 to return "true" and I check this via an if I could either throw new std::exception(...); and have to catch it somewhere or I could return NULL for the function calling that function and just pass the problem on, what the exception also does somehow. So I would like to have some opinions about this. Thanks, Xaser
  13. Finally managed to fix the problem myself. The problem was located in the std::bind call: HandleMap[QUESTCOMPLETE] = std::tr1::bind(&MyGame::Game::OnAddMoney, this, std::tr1::placeholders::_1); Everytime I used it I had a function which had one parameter. Therefore I got used to always ad a placeholder, which in this case led to the error as the Function OnAddMoney has no parameter. Hope this helps also in other cases! Xaser
  14. XaserIII

    I need headphones...

    Just do me a favour and don't follow the trend of these Dr. Dre Beats Headphones. In my opinion, they are, just like the iPhone more a trend than pure quality. If you want good quality for a fair price have a look at Sennheisers or at my favourite Shure Studio Headphones SRH840. Absolutely Top! Xaser
  15. XaserIII

    dll , main and singleton

    You definitely should update to the current Version of VS 2010. Its free in the express version and contains everything you need. Download Here I would highly recommend the All-In-One iso. Back to the Problem. LPFNDLLFUNC1 is just a function pointer. About haegarrs Idea: I don't think that GetModuleHandle will be of much use, because it will just give you the pointer to the Main Module, but you can't do anything really with it when the main doesn't export the Singleton via dllexport, but I'm not sure how dllexport works if it is used in an executable not in a DLL. Guigio could you try and explain what exactly you want to achieve please. Xaser
  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!