![]() |
Communication with a webserver
Just wondering if it's possible.
Eg on a site you could enter an account and if they are online on the server it would trigger a script to display a message to them? I'm wondering how because I am trying to code something that would allow me to go on a URL and communicate with players on a server. I already know how to send data to a webserver, but not how to send data to the gserver. |
You can use TSocket to listen on a port and then talk to that port from your webserver. If you're using PHP or some language that doesn't make it real easy to work with raw sockets, you might want to consider using Grattpd to wrap your communication in HTML (just like any regular API).
Normally you have to request access to bind to a specific port from Stefan, but you can also bind to port 0, which will randomly choose a port to bind to. Once you do this, call a script on your webserver with the port and have the webserver save the IP and port so that it can contact the gserver when necessary. Look at Grattpd for how I did this. |
Thanks for the informative post, I will post in the code gallery when it is complete :)
I will still be using PHP to handle a few things on the webservers side. Edit: Already ran into a problem... Quote:
|
Quote:
Here's the listen socket code I'm using: PHP Code:
PHP Code:
|
Ahh I was doing it wrong....
Thanks for the kick in the right direction. Ans thanks for the examples, it will definitely help a lot. Whoever neg repped me for "ran into you", lolwhat what ran into me? XD |
| All times are GMT +2. The time now is 02:09 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.