Discussion:
winsock2 server help.
(too old to reply)
Francis
2010-03-14 18:29:01 UTC
Permalink
Raw Message
Well I have been studying Winsock2 from msdn for the past few weeks tring to
understand it. Using Visual C++ Express Edition 2008 here. So far I managed
to understand how to make a simple client/server connect then send some test
data such as char* then close.

Then I have been looking at the v7.0\Samples\netds\winsock\iocp\server
example tring to understand it, but I kinda failed. Failed at tring to figure
out the peoper way to handle multiple client connections properly, and how to
send other types of data other then char*.

From what I do understand is:
1.Initialize Winsock.
2.Create a socket.
3.Bind the socket.
4.Listen on the socket for a client.

I think after is where I get lost. I don't get how to handle multiple users.
That is why I was looking at the iocp example hoping I would understand it.
Maby I missed a rquirement that I was supposed to understand before looking
at that example I don't know.

These are some things I am tring to understand atm:
1. How the server can accept multiple clients.
2. The proper way to send data other then just char* data.

I've seen some post on other forms metioning doing something like
#define VAR0 0x01 #define VAR1 0x02 etc.. Or even doing something like
packet id, command, data in a struct or something. Then when they go to send
the data with iSendResult = send(socket, char buf, length, flags) they use
that info for the send. I don't get it though.

This is what I want to beable to do atm as a learning project for me.
Console server acts as a login server when the client types a username and
password on the client side, and clicks send the server accepts the
connection then reads that info in, and then passes it to the database for
checking. If true tell the client to advanced to the next screen on the
client side. Last close the client connection since the client will then
connect to another console server to handle the next part of the process.
Kinda like how an mmo server might do it although I am not looking to program
an mmo atm. That is way in the future if I ever decide I want to do one which
is not likely. lol.

So I think what I am asking is if anyone has time to help me understand
winsock2 better. Maby there is some books, or guides that can help me better
understand winsock2. Because I'm not getting much of anywhere with them
examples. Although them examples are well done thanks Microsoft for them
examples.
Francis
2010-03-15 14:58:01 UTC
Permalink
Raw Message
I figured it out. You can close topic.
Post by Francis
Well I have been studying Winsock2 from msdn for the past few weeks tring to
understand it. Using Visual C++ Express Edition 2008 here. So far I managed
to understand how to make a simple client/server connect then send some test
data such as char* then close.
Then I have been looking at the v7.0\Samples\netds\winsock\iocp\server
example tring to understand it, but I kinda failed. Failed at tring to figure
out the peoper way to handle multiple client connections properly, and how to
send other types of data other then char*.
1.Initialize Winsock.
2.Create a socket.
3.Bind the socket.
4.Listen on the socket for a client.
I think after is where I get lost. I don't get how to handle multiple users.
That is why I was looking at the iocp example hoping I would understand it.
Maby I missed a rquirement that I was supposed to understand before looking
at that example I don't know.
1. How the server can accept multiple clients.
2. The proper way to send data other then just char* data.
I've seen some post on other forms metioning doing something like
#define VAR0 0x01 #define VAR1 0x02 etc.. Or even doing something like
packet id, command, data in a struct or something. Then when they go to send
the data with iSendResult = send(socket, char buf, length, flags) they use
that info for the send. I don't get it though.
This is what I want to beable to do atm as a learning project for me.
Console server acts as a login server when the client types a username and
password on the client side, and clicks send the server accepts the
connection then reads that info in, and then passes it to the database for
checking. If true tell the client to advanced to the next screen on the
client side. Last close the client connection since the client will then
connect to another console server to handle the next part of the process.
Kinda like how an mmo server might do it although I am not looking to program
an mmo atm. That is way in the future if I ever decide I want to do one which
is not likely. lol.
So I think what I am asking is if anyone has time to help me understand
winsock2 better. Maby there is some books, or guides that can help me better
understand winsock2. Because I'm not getting much of anywhere with them
examples. Although them examples are well done thanks Microsoft for them
examples.
Loading...