Jump to content


Photo

Could anyone make one c++ server w/ websocket ?


  • Please log in to reply
2 replies to this topic

#1 Crhonos

Crhonos

    GMC Member

  • GMC Member
  • 235 posts
  • Version:GM:Studio

Posted 26 April 2012 - 07:21 PM

Thats my question, i have here a 39dll.lib with all the functions of 39dll to use in a C++ aplication, what i ask, i don't know how hard to do is this, is to someone make something like the 39dll.lib but using websockets.Still for c++.

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);
}

}

  • 0

#2 thijsmie

thijsmie

    GMC Member

  • GMC Member
  • 27 posts

Posted 28 April 2012 - 10:14 AM

You could check out the GMWS websocket extension, also posted on this forum. He released his websocket to winsocket translator source on the second or third page. You can learn a lot from that :)
  • 0

#3 Crhonos

Crhonos

    GMC Member

  • GMC Member
  • 235 posts
  • Version:GM:Studio

Posted 29 April 2012 - 05:32 AM

You could check out the GMWS websocket extension, also posted on this forum. He released his websocket to winsocket translator source on the second or third page. You can learn a lot from that :)


Ofcourse i can learn, but i can t compile his source =(
It simply not working, and the compiler acuses the Base64 and Sha1 libs as problems.

I get this error:

18:51 F:\W Browser Stuff\gmws_source\SHA1.h [Warning] no newline at end of file


Edit:Got it compiled and running. But yet i don't think i can learn from it, it's more complicated than what i can understand =(
yet i will keep trying here...

Edited by Crhonos, 29 April 2012 - 06:02 PM.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users