socket_open - error
#include <amxmod>
#include <sockets> public plugin_init() { register_plugin("http","1.0","test socket") return PLUGIN_CONTINUE } public client_connect(id) { new sock = -1 new err new readBuffer[2048] sock = socket_open("127.0.0.1", 81, SOCKET_TCP, err) server_print("%d", err) socket_send(sock, "GET: http://127.0.0.1/index.php^r^n", 512) socket_send(sock, "Host: 127.0.0.1^r^n^r^n", 512) socket_recv(sock,readBuffer,2048) server_print("%s", readBuffer) socket_close(sock) return PLUGIN_CONTINUE } ********************************************* server_print("%d", err) always err = 0 If port open or port close use amxx 1.8.1 what i do not so ? |
Re: socket_open - error
1. Default HTTP port is 80 (unless the site is configured otherwise)
2. You have the HTTP request formatted incorrectly. 3. You should send the entire HTTP request in 1 packet 4. You are trying to receive data immediately after sending it. No web server will respond that fast. Untested PHP Code:
|
| All times are GMT -4. The time now is 01:36. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.