Advertisement

help with error full code ..

Started by August 02, 2003 10:16 PM
4 comments, last by logout 21 years, 6 months ago
Okay i wanted to make a simple game to test some of the ideas i had about servers .. only problem is my game is stuck ! and i really cant figure out what the F that is wrong ! my send function returns 10038 ( WSANOTSOCK , or somthing like that) but i am sure that is a socket ... witch i cant be since i get the error : so i need someone else to tell me why it aint a socket. you can find the code here: ( it aint that big only its neater in a .zip file ) http:\\www.geocities.com\g_sondre if you have any idea whats causing it and how to fix it i did extremely thankfull... ( allso any other constructive critic is ok ... ) [edited by - LogouT on August 2, 2003 11:16:58 PM]
man... even for test code, that''s some really ugly code!

I can''t run it because I don''t have VC .NET, but at a glance... you''re creating the socket in something''s constructor, but your compiler may create that object before WSAStartup() is called.

Aside from that, your code is hard to even look at, to be honest.
Advertisement
well if you have any ideas for inprovment over my ugly code plz share it with me .. ( as i aint too keen on going around with a ugly-code style )
*some off the uglyness is partly because i in my egerness after fixing the app i tryed a LOT of diffrent things ! *



besides from that: i do get the first packet tru
( from client to server ). So i must have a ok socket ???


plz help im really desprate
Your code is not that ugly, I don''t know what he was talking about. The only thing I would suggest is that you put all your function code from one class into the same file.

It isn''t the object constructor because the object is local to main (and the object is created after Winsock Startup).

cout << "this is my stocks" << endl;
should be "these are my stocks" unless I am mistaken...

I do not have .net so I can''t run your program but this info from the msdn site may be of help:

Socket operation on nonsocket. An operation was attempted on something that is not a socket. Either the socket handle parameter did not reference a valid socket, or for the select function, a member of an fd_set structure was not valid.

So find out on which line you get this error and that should point to your problem. If not, follow any operations done on that socket back through your program. Hope that helps.
-Greg

Reverie Entertainment
Looks that at some point the socket gets closed prematurely and so any operation on it results in this error. Put a breakpoint on every "closesocket()" function call.

-cb
well cbenoi1 i tryed doing that and i am sure that the server dosent close the server ...


also it not hard to convert my files into a other progject ..

just add the .cpp and the .h files to a VC6++ progject and hit compile ...


any other ideas ?

This topic is closed to new replies.

Advertisement