balliztik1 Posted December 8, 2009 Author Share Posted December 8, 2009 I'm not sure if the socket check exists in earlier versions, but in Eclipse Stable, it does not do its job. It checks for the wrong error code, and does not put the error catch in the right sub, anyway, so instead of the error handle dealing with the problem, the server just crashes. The problem is here:``` ' Error handling for 'Address in use' error Err.Clear On Error Resume Next ' Start listening GameServer.StartListening ' RTE 10048 occured If Err.Number = 10048 Then Call MsgBox("The port on this address is already busy.", vbOKOnly) End End If```The problem is twofold. One, StartListening is not a method, but rather a sub within a class. Therefore, any errors with the sub must be caught within that sub, not elsewhere. Secondly, error 10048 does not apply to the socket type used. These sockets use RTE -2147352567(80020009) when an error occurs. So, even if the error occurred here, it wouldn't be caught. The error catching must be placed within the StartListening sub. Find it:```Public Sub StartListening()On Error Resume Next m_Server.StartListening If Err.Number <> 0 Then Call MsgBox("The port on this address is already busy.", vbOKOnly) DestroyServer End IfEnd Sub```As shown here, this altered sub looks for the correct error number, then handles the destruction of the server. I swapped out End for DestroyServer simply because this is how nearly every other process handles a server shutdown.All in all, this won't really affect much, since the error handler doesn't exactly do much different than a server crash. However, it should work correctly regardless. Link to comment Share on other sites More sharing options...
Robin Posted December 8, 2009 Share Posted December 8, 2009 Who would make Winsock its own class? :\ Link to comment Share on other sites More sharing options...
balliztik1 Posted December 8, 2009 Author Share Posted December 8, 2009 It's not Winsock, I don't believe. There's a Winsock object on frmServer, but it doesn't look like it's actually used, save for one instance. Link to comment Share on other sites More sharing options...
Robin Posted December 8, 2009 Share Posted December 8, 2009 Oh Christ, they're not still using IOCP are they? >_>;Either remove it, or fix up Ron's old .dll file. It's got a huge memory leak in it. Link to comment Share on other sites More sharing options...
damian666 Posted December 8, 2009 Share Posted December 8, 2009 i didnt touch that, hell, i tried running two servers, and it reports the port in use like it should O.oDamian666i thought we were using winsock? Link to comment Share on other sites More sharing options...
balliztik1 Posted December 8, 2009 Author Share Posted December 8, 2009 Yeah, I think it's IOCP. I was actually working on something of my own with Winsock, so I checked out ES and MS4 as reference. When I noticed two different systems were using the same code, I poked around and fixed this minor issue. I don't really want to poke too hard, though. XD@[SB:> Damian666 link=topic=55098.msg583353#msg583353 date=1260259268]> i didnt touch that, hell, i tried running two servers, and it reports the port in use like it should O.o> > Damian666> > i thought we were using winsock?As did I. I forget when it was swapped over, but there's remnants of Winsock code still there. As for the report, the server throws an error. It essentially catches the multiple port issue, but not due to error handling. It just crashes. Link to comment Share on other sites More sharing options...
damian666 Posted December 8, 2009 Share Posted December 8, 2009 ok, so… ill add this for now, but should we not use winsock instead?please note im not good enough for network stuff like this, but if we have to move it, i will...Damian666 Link to comment Share on other sites More sharing options...
balliztik1 Posted December 8, 2009 Author Share Posted December 8, 2009 IOCP's better for multithreaded programs, from what I've read, but much more complicated. Plus, if the current system has a memory leak, that's never a good thing. Winsock suits the needs, I suppose. I've never seen it have any problems.And fixed a lil' bit in the code above. Apparently, the error number can't be specified. It's one of those really weird errors. Link to comment Share on other sites More sharing options...
damian666 Posted December 8, 2009 Share Posted December 8, 2009 well, cant we replace that custom dll with the normal one?and ok, ill update the code ^^Damian666 Link to comment Share on other sites More sharing options...
Robin Posted December 8, 2009 Share Posted December 8, 2009 @[SB:> Damian666 link=topic=55098.msg583362#msg583362 date=1260261138]> well, cant we replace that custom dll with the normal one?> > and ok, ill update the code ^^> > Damian666The .dll Ron edited for Mirage won't work with Mirage. He edited it to allow for your stupidly large string packets which causes a memory leak.Only use IOCP if you know the theory behind it and you're using byte arrays. Link to comment Share on other sites More sharing options...
damian666 Posted December 8, 2009 Share Posted December 8, 2009 ah, so first we need to move to byte arrays, seeying that will reduce our large packets.then we can use iocp? or would we still be smart moving to winsock?Damian666 Link to comment Share on other sites More sharing options...
Robin Posted December 8, 2009 Share Posted December 8, 2009 You can't move to IOCP because you don't understand how it works. Link to comment Share on other sites More sharing options...
damian666 Posted December 8, 2009 Share Posted December 8, 2009 thats true, but that doesnt mean i dont wanna learn mate…even if i cant get close to put it in, im sure i will learn a thing or 2 ^^Damian666 Link to comment Share on other sites More sharing options...
Robin Posted December 8, 2009 Share Posted December 8, 2009 If you don't understand the need to make the backbuffer dynamically sized, you won't understand the C++ code which the .dll is made from. Link to comment Share on other sites More sharing options...
damian666 Posted December 8, 2009 Share Posted December 8, 2009 c++ code?im sure i wont understand it :/damn…out of my league, very even XDok, sorry to waste your time, i just keep busy with simple things...Damian666still hope that somebody capable is gonne do it ^^ Link to comment Share on other sites More sharing options...
Robin Posted December 8, 2009 Share Posted December 8, 2009 There's really no reason. Byte arrays are just as good when using Winsock, which is what I use. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now