Well, my project is dead in the water until I can find another way to convert an int into a socket. Does anyone know of a third party lib I can use in visual c that handles converting ints to sockets?
Re: Winsock2 woes
By: Xucaen to All on Wed Nov 25 2015 02:17 pm
Well, my project is dead in the water until I can find another way to convert an int into a socket. Does anyone know of a third party lib I can use in visual c that handles converting ints to sockets?
A socket descriptor is an integer (both on Windows and *nix). This is from >winsock.h:
typedef u_int SOCKET;
Perhaps if you posted some sample code or more details about exactly what >you're having an issue with, we could help. We've done this stuff before. :-)
Re: Winsock2 woes
By: Xucaen to All on Wed Nov 25 2015 02:17 pm
void IOHandler::writeBytes(string line) const
{
cout << line;// << endl;
if (dropfile->commType == 0)
{
cout << line;
}
Re: Winsock2 woes
By: Xucaen to All on Wed Nov 25 2015 02:17 pm
Well, my project is dead in the water until I can find another way to convert an int into a socket. Does anyone know of a third party lib I can use in visual c that handles converting ints to sockets?
A socket descriptor is an integer (both on Windows and *nix). This is from >winsock.h:
typedef u_int SOCKET;
Perhaps if you posted some sample code or more details about exactly what >you're having an issue with, we could help. We've done this stuff before. :-)
Hi DM (may I call you DM? ;)
I have this at the top of my source file:
#pragma comment(lib, "Ws2_32.lib")
#include <WinSock2.h>
Then I have a function that writes data to the socket
void IOHandler::writeBytes(string line) const
{
cout << line;// << endl;
if (dropfile->commType == 0)
{
cout << line;
}
else if (dropfile->commType == 2)
{
int bytes = ::send((SOCKET)dropfile->handle, line.c_str(), strlen(line.c_str()), 0);
}
}
Then, I set up the program as a door using DOOR32.SYS.
I verified my read function reads the file correctly and
in my first test I got a socket handle 1480.
in SCFG I pass the door file path using %f on the command line, no IO redirection, Native Executable Yes.
When I telnet in from my other PC using SyncTerm, the game loads on the server but SyncTerm shows a blank screen
but when I run the game locally I see the correct output.
Well, my project is dead in the water until I can find another way to convert an int into a socket. Does anyone know of a third party lib I can use in visual c that handles converting ints to sockets?
Are you calling WSAStartup()?
Did you check the return value of send()?
Have you looked at any working example code (e.g. sbbs/xtrn/sdk)?
Re: Winsock2 woes
By: Xucaen to Digital Man on Thu Nov 26 2015 10:01 am
#pragma comment(lib, "Ws2_32.lib")
#include <WinSock2.h>
Then I have a function that writes data to the socket
void IOHandler::writeBytes(string line) const
{
if (dropfile->commType == 0)
{
cout << line;
}
else if (dropfile->commType == 2)
{
int bytes = ::send((SOCKET)dropfile->handle, line.c_str(), strlen(line.c_str()), 0);
}
}
Are you calling WSAStartup()?
Sysop: | Chris Crash |
---|---|
Location: | Huntington Beach, CA. |
Users: | 579 |
Nodes: | 8 (0 / 8) |
Uptime: | 00:54:45 |
Calls: | 10,740 |
Files: | 5 |
Messages: | 444,492 |