This is a piece of the 39dll.lib code i have:
double tcplisten(double port, double max, double mode)
{
CSocket* sock = new CSocket();
if(sock->tcplisten((int)port, (int)max,(int)mode))
return AddSocket(sock);
delete sock;
return -1;
}So if we had it transformed it would be somethin like that:
double tcplisten(double port, double max, double mode)
{
WSocket* sock = new WSocket();
if(sock->tcplisten((int)port, (int)max,(int)mode))
return AddWSocket(sock);
delete sock;
return -1;
}[/code]
Where Wsocket is the class of websockets and everything else.
TGMG made one javascript server that listen to websockets, what i am asking is just to do the same thing, but using C++.
Then i would get my 39dll file functions, and the new library functions and make one bi-platform server =D
Doing something like that:
void setype(int type)
{//set the kind of socket connection the client has.
socketype = type;
}
double writebyte(double val, double buffid)
{
if setype==0{// if client has normal socket connection
CBuffer*buff = (CBuffer*)buffers.item((int)buffid);
if(buff == NULL)return 0;
return buff->writebyte((unsigned char)val);}else {//if client has web socket connection
WBuffer*buff = (WBuffer*)buffers.item((int)buffid);
if(buff == NULL)return 0;
return buff->writebyte((unsigned char)val);
}
}











