Re: Socket plugin (TCP/UDP) v0.1a -
AndreT - 12.05.2012
Quote:
Originally Posted by -Luis
Would you be able to give me a small example on what I could do to make a live chat, would I be able to make it show on my User Control Panel?
|
Most definitely, I ran a ****** search and found
this tutorial. While it might not be the most simplistic solution, it gives you a good overview of how messages are "sent" (well actually put into log.html) by post.php, which can act as your socket server for website-to-gameserver chatting.
This post of mine has some PAWN (client) and PHP (server) code, you could easily combine these with some code for live chat, but I am not going to go over the js (jQuery), HTML or the design as I am not really familiar with such cases.
Quote:
Originally Posted by C0dy09
oh thats very cool! but very extreme examples? i read s.th from mauzen about server clustering, how to do this in theoretical?
/ot: i love my english but still learning
|
If I understand what he means correctly, it is a bunch of servers feeding data to one (web) application? In such case, the application acts as a socket server and the servers connect to it. Can you think of any interesting features that this could provide?
Re: Socket plugin (TCP/UDP) v0.1a -
Luis- - 12.05.2012
Thanks Andre, I checked your tutorial and I always get the "Could not bind to socket".
Re: Socket plugin (TCP/UDP) v0.1a -
AndreT - 13.05.2012
Replace the socket initialization lines with:
PHP код:
$socket = socket_create(AF_INET, SOCK_STREAM, getprotobyname('tcp')) or die("Error in socket_create: " . socket_strerror(socket_last_error($socket)) . "\n");
socket_bind($socket, "127.0.0.1", 7778) or die("Error in socket_bind: " . socket_strerror(socket_last_error($socket)) . "\n");
socket_listen($socket, 5) or die("Error in socket_listen: " . socket_strerror(socket_last_error($socket)) . "\n");
This will give you a more precise error description. If you consider the code looking bad, compare the function results to false (a type and value check with === not ==) and call socket_strerror(socket_last_error($socket)).
The most common mistakes I see people making with these is:
1. using localhost instead of numeric host - this does (on most systems at least) not work
2. using a common communication port - something is already using this port
Try to see what the script gives you now, also how are you trying to run it?
If posting PHP and general socket-related talk bothers someone as it really is not about the plugin, please let me know.
AW: Socket plugin (TCP/UDP) v0.1a -
C0dy09 - 13.05.2012
no I mean with clustering that f.e. when a Server stopps running(maybe because of ddos) immediately another server comes and the player can going on playing without disconnects and maybe a shord lag
Re: Socket plugin (TCP/UDP) v0.1a -
Luis- - 13.05.2012
This is the error i'm getting,
Код:
Error in socket_bind: Only one usage of each socket address (protocol/network address/port) is normally permitted.
Re: Socket plugin (TCP/UDP) v0.1a -
Hiddos - 13.05.2012
Nice one, I'll be sure to try this one out sooner or later.
Re: Socket plugin (TCP/UDP) v0.1a -
T101 - 15.05.2012
Dear BlueG,
Please give us some hope and tell us, that you still take care of this nice project.
Personally, i'm still very waiting for the SSL support.
Regards,
T101
Re: Socket plugin (TCP/UDP) v0.1a -
BlueG - 20.05.2012
Quote:
Originally Posted by KoczkaHUN
I tried with NetCat, tried to CTRL+C it, or closing the Command Line, no success. RemoteDisconnect never gets called.
|
The callback gets called in case the socket was properly closed (aka a closesocket/shutdown call). In order to determine whether a socket has disconnected (timeouts, crashes etc), you'll have to send PING requests to all sockets. Set a timer or save a timestamp and make sure the socket replies within
X seconds. If a socket doesn't reply you can close/shutdown the socket.
That's what IRC servers do to check if a client is still connected. They send "PING" messages at regular intervals to the clients and wait for a "PONG" reply.
You should ******
handshake protocol if you need more information about how sockets work.
Quote:
Originally Posted by T101
Dear BlueG,
Please give us some hope and tell us, that you still take care of this nice project.
Personally, i'm still very waiting for the SSL support.
Regards,
T101
|
I've recently fixed some small bugs, so yea, I still take care of this project. I'll most likely add support for SSL as soon as I get more time.
Re: Socket plugin (TCP/UDP) v0.1a -
Jonny5 - 20.05.2012
this is very good work!
i remember messing with sockets in the old vb6.0 days !
Im sure Ill be using this in the near future!
Re: Socket plugin (TCP/UDP) v0.1a -
T101 - 22.05.2012
Quote:
Originally Posted by BlueG
I've recently fixed some small bugs, so yea, I still take care of this project.
|
These are great news for all of us, thanks for it BlueG

.
Quote:
Originally Posted by BlueG
I'll most likely add support for SSL as soon as I get more time.
|
I already can't wait for the release of the SSL version...

.
Regards,
T101
Re: Socket plugin (TCP/UDP) v0.1a -
Luis- - 08.06.2012
Quote:
Originally Posted by -Luis
This is the error i'm getting,
Код:
Error in socket_bind: Only one usage of each socket address (protocol/network address/port) is normally permitted.
|
I am still getting this error.
Re: Socket plugin (TCP/UDP) v0.1a -
Luis- - 12.06.2012
Seriously? I know somebody knows how I could attempt to fix this. Please!
Re: Socket plugin (TCP/UDP) v0.1a -
Luis- - 13.06.2012
God sake! Can someone explain what I am doing wrong please?
Re: Socket plugin (TCP/UDP) v0.1a -
VeryGooD - 15.06.2012
Quote:
Originally Posted by dEzIRE
the plugin crashes the server when it receives data on Linux (Centos).
on windows it works perfectly...
|
+1
fix it please.
Re: Socket plugin (TCP/UDP) v0.1a -
Misiek - 16.06.2012
Код:
*** glibc detected *** ./samp03svr: free(): invalid pointer: 0xf4673b40 ***
======= Backtrace: =========
/lib32/libc.so.6(+0x6b511)[0xf758c511]
/lib32/libc.so.6(+0x6ce1b)[0xf758de1b]
/lib32/libc.so.6(cfree+0x6d)[0xf7590f8d]
plugins/socket.so(ProcessTick+0x12b)[0xf6a2ab4b]
./samp03svr[0x80a18c2]
./samp03svr[0x807d99a]
./samp03svr[0x8077c23]
/lib32/libc.so.6(__libc_start_main+0xe7)[0xf7537e37]
./samp03svr(__gxx_personality_v0+0xf5)[0x804b4c1]
That's on Ubuntu. Too bad. It didn't crash upon receiving data, but when its connection with a client has been broken.
The plugin worked as a TCP server. The client could successfully connect and remained connected for a few minutes. When I closed the client, the server crashed. Let me know if I could provide any additional data.
Followup:
Код:
*** glibc detected *** ./samp03svr: free(): invalid pointer: 0xf4588b40 ***
======= Backtrace: =========
/lib32/libc.so.6(+0x6b511)[0xf74a1511]
/lib32/libc.so.6(+0x6ce1b)[0xf74a2e1b]
/lib32/libc.so.6(cfree+0x6d)[0xf74a5f8d]
plugins/socket.so(ProcessTick+0x12b)[0xf693fb4b]
./samp03svr[0x80a18c2]
./samp03svr[0x807d99a]
./samp03svr[0x8077c23]
/lib32/libc.so.6(__libc_start_main+0xe7)[0xf744ce37]
./samp03svr(__gxx_personality_v0+0xf5)[0x804b4c1]
This time it crashed right after sending an initial welcome message to the client.
Re: Socket plugin (TCP/UDP) v0.1a -
Misiek - 16.06.2012
Hello there.
Код:
pData.remote_client = (char*)malloc(sizeof(char*)*15);
pData.remote_client = inet_ntoa(remote_client.sin_addr);
->
Код:
pData.remote_client = (char*)malloc(sizeof(char*)*15);
strcpy(pData.remote_client, inet_ntoa(remote_client.sin_addr));
Seems to fix the problem.
Re: Socket plugin (TCP/UDP) v0.1a -
Luis- - 18.06.2012
Please can somebody help me with my problem?
Re: Socket plugin (TCP/UDP) v0.1a -
pyrodave - 18.06.2012
You're trying to open a socket on a port which is already in use. Try another port number.
Re: Socket plugin (TCP/UDP) v0.1a -
Luis- - 18.06.2012
I've tried quite a few ports and I still have the same problem.
Re: Socket plugin (TCP/UDP) v0.1a -
pyrodave - 18.06.2012
What ports have you tried, and can you show your code?