🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

ohhh my god! I need help!

Started by
1 comment, last by elmo 23 years, 11 months ago
hello out there! im going crazy ive tried serveral ways to code (using winsock/ c++) a server software which accepts connections and a client software which connect to the server and recv data from the server... i have read some tutorials but i dont understand the basic so i cant help myself coding my app. my app works not the way i want ... the client will be accepted by the server but i cant send data from the server to the client... i want to understand the basics! here are some questions: ======================== what in hell is WM_USER+x ??? which value should i use for x and musst i use the same values n server and client site ex: WM_CLIENT WM_USER+10 and so on... am i right that the server accept a connection make it async using WSAA.... and than close the connection???? why that - in the demo code they do it this way. i will send data and resv data so why to close the connection???? what will be especialy happend when i use socket(... accept(... or connect(... is it like a pipe to the client pc or in which way is winsock build. when will the FD_READ, FD_CONNECT, FD_WRITE message comes up... ... ohhh no i have so many questions - where can i get a good winsock tutorial - to understand the basics of winsock communication... i think that is my problem. i understand the tutorial code but cant transfer it to my ideas if anybody out there can help - it will be very great a link to a tutorial will be helpful or good book to buy thanks for all elmo
Advertisement
having just recently learned winsock, it''s time for me to share some knowledge. all the vets correct me if i''m wrong.


wmuser+1 is a constant for adding another event. just stick with +1, because i''ve tried others, and it screws it up. there are ranges that are reserved, but i would imagine that if you want to add another event in your winproc, you do wmuser+2, but i''m not sure...

the tutorial probably closes the LISTENING socket. after the clients are connected and you don''t want to let anybody else in, you stop LISTENING.

after you have the connection going, it''s pretty much like a pipe, but you still have to worry about SYNCHRONIZATION though.

fdwrite comes up when you send, fdread when there is something available to be read. that''s why recv() is under the fdread event.

just keep working at it. i''ve worked off only about 2 tutes which, one of them is the one by stefan, which is probably the same one you used. it was a good, straightforward tutorial. i stripped it away of the directx, and put opengl in there, and sorta got it working. the server was still synchronous, like stefan''s but i''m sure once i get it to async, it should do something pretty cool.

a2k
------------------General Equation, this is Private Function reporting for duty, sir!a2k
hi!

fdread comes up if data is there to read ....
my server sends data to the client... but on my client site i only get the following events at client startup and than nothing else comes up... one FD_CONNECT, one FD_WRITE and one FD_CLOSE

the server told me that the client perfectly logged in and that the server accept the connection and build up a new socket for this client.

but why get the client the FD_CLOSE event... i dont close the connection ... or is it mean that i close the connection on the server site and the client told me through a FD_CLOSE event that the server side is down.

i have delete all closesocket lines in my code but nevertheless i get the FD_CLOSE event on the client site.

my server should accept not only one connection. so is it right that i (on the server site) always listen to my serversocket... if a client wants to come in i accept the socket and a new socket is born ...

i think i make a stupid mistake - or ????
elmo


ps. ddraw was much easier to learn (i think) or perheps i got the wrong tutorials :-(

This topic is closed to new replies.

Advertisement