I am doing a little proof of concept or prototype sample of a door for Synchronet. I have played with socket server examples under linux, and I am familiar with the concept of sockets as file handles. Winsock2 is supposed to be the same way. However, in linux, I can send() and recv() to/from the stdout, stdin, and stderr file handles. But that doesn't seem to be the case with WinSock2, even though I have read on MSDN that it should be.
I wanted to know maybe I was going about this ther wrong way. I was assuming that the drop file from Sunchronet, and any BBS really, would be passing the file handle of the connected socket, so I should just be able to take that handle and send/recv. Have I asumed correctly?
I've been at this too long for today so I am going to bed now. If there is any advice to be given (besides don't use winsock <G>) I am happy to hear it.
Re: need help with winsock2
By: Xucaen to All on Tue Nov 24 2015 11:49 pm
I am doing a little proof of concept or prototype sample of a door for Synchronet. I have played with socket server examples under linux, and I am
familiar with the concept of sockets as file handles. Winsock2 is supposed to be the same way. However, in linux, I can send() and recv() to/from the stdout, stdin, and stderr file handles. But that doesn't seem to be the case
with WinSock2, even though I have read on MSDN that it should be.
On Windows, send() and recv() as strictly for sockets (cannot be used on file >descriptors).
I wanted to know maybe I was going about this the wrong way. I was assuming that the drop file from Synchronet, and any BBS really, would be passing the
file handle of the connected socket, so I should just be able to take that handle and send/recv. Have I assumed correctly?
It's a socket descriptor, and yes, you can send/recv using it (the one provided
in the door32.sys and xtrn.dat drop files and with the %h command-line >specifier).
I've been at this too long for today so I am going to bed now. If there is any advice to be given (besides don't use winsock <G>) I am happy to hear it.
JavaScript makes all those headaches go away. You might consider writing your >door in that instead of a native language, like C/C . It's all the rage. :-)
Re: need help with winsock2
By: Xucaen to All on Tue Nov 24 2015 11:49 pm
I am doing a little proof of concept or prototype sample of a door for Synchronet. I have played with socket server examples under linux, and I am
familiar with the concept of sockets as file handles. Winsock2 is supposed to be the same way. However, in linux, I can send() and recv() to/from the stdout, stdin, and stderr file handles. But that doesn't seem to be the case
with WinSock2, even though I have read on MSDN that it should be.
On Windows, send() and recv() as strictly for sockets (cannot be used on file >descriptors).
I had read on MSDN that WriteFile and ReadFile functions will work like send and recv except with file descriptors (including socket descriptors). The problem I am facing is I am trying to WriteFile to the stdout file descriptor and it is not working. My belief was that if I could get that to work, then I know WinSock2 is a viable solution and I can move on to my next step. But I've slept since then, so..
I wanted to know maybe I was going about this the wrong way. I was assuming that the drop file from Synchronet, and any BBS really, would be passing the
file handle of the connected socket, so I should just be able to take that handle and send/recv. Have I assumed correctly?
It's a socket descriptor, and yes, you can send/recv using it (the one provided
in the door32.sys and xtrn.dat drop files and with the %h command-line >specifier).
I think right now I am going to try this - and stop trying to get Windows to do things that Linux can do so easily. ;-) I decided to use door32.sys (only because it looked simpler to use).
The first line is the type of connection.
I'll check that and if the type is local I'll stream to cout.
Probably what
I should have done in the first place but I couldn't help attempting to be clever. (again with the sleep thing, I know better today) ;-)
I've been at this too long for today so I am going to bed now. If there is any advice to be given (besides don't use winsock <G>) I am happy to hear it.
JavaScript makes all those headaches go away. You might consider writing your >door in that instead of a native language, like C/C . It's all the rage. :-)
Well, it's a long story. My "game" is already written in c -as-a-better-c <g>, I'm just trying to send the output (programmatically) to the socket.
Once I get this working, I have other ideas for another game I want to build from scratch.
Sysop: | Chris Crash |
---|---|
Location: | Huntington Beach, CA. |
Users: | 577 |
Nodes: | 8 (0 / 8) |
Uptime: | 73:01:50 |
Calls: | 10,734 |
Files: | 5 |
Messages: | 442,755 |