This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Module: Sockets_hz ( listenning + nonblocking ) ... working :)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 07-01-2009 , 18:11   Re: Module: Sockets_hz ( listenning + nonblocking ) ... working :)
Reply With Quote #1

hackziner can you make this #25 request? :-D
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
Multiply
Member
Join Date: Jun 2006
Location: Denmark
Old 08-20-2009 , 12:20   Re: Module: Sockets_hz ( listenning + nonblocking ) ... working :)
Reply With Quote #2

Resurrection of an old post, sorry.

Anyway.. I'd use this _alot_ if you could get rid of the need for tasks/loops, and the like, as already suggested.

In general, this would make it a whole lot easier to read, and play around with.
__________________
Wah?
Multiply is offline
Send a message via MSN to Multiply Send a message via Skype™ to Multiply
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 08-20-2009 , 15:19   Re: Module: Sockets_hz ( listenning + nonblocking ) ... working :)
Reply With Quote #3

What's wrong with tasks ? They'r needed for TCP connection and hackziner is a bit busy until september or something like that.
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 11-12-2009 , 10:08   Re: Module: Sockets_hz ( listenning + nonblocking ) ... working :)
Reply With Quote #4

A folk remembered me that I modified this module for use in a plugin of mine. The difference is that since socket_open does one operation in blocking mode it still can hang the server. So, this version brings socket_open_non_blocking so all the operations can be done in non blocking mode. Source, win and linux version in the zip file here http://forums.alliedmods.net/showthread.php?t=99516

(Confirmed by hackziner)
__________________

Last edited by joaquimandrade; 11-16-2009 at 14:07.
joaquimandrade is offline
issen1
Member
Join Date: Jan 2010
Old 10-18-2010 , 06:56   Re: Module: Sockets_hz ( listenning + nonblocking ) ... working :)
Reply With Quote #5

Quote:
Originally Posted by joaquimandrade View Post
A folk remembered me that I modified this module for use in a plugin of mine. The difference is that since socket_open does one operation in blocking mode it still can hang the server. So, this version brings socket_open_non_blocking so all the operations can be done in non blocking mode. Source, win and linux version in the zip file here http://forums.alliedmods.net/showthread.php?t=99516

(Confirmed by hackziner)
Can someone edit this in the first post, please? I was nearly about to edit hz original package myself. Thank you!
__________________
greets (:
issen1 is offline
AntiBots
Veteran Member
Join Date: May 2008
Location: Brazil
Old 11-22-2009 , 18:52   Re: Module: Sockets_hz ( listenning + nonblocking ) ... working :)
Reply With Quote #6

Any want a update of this?? I am working and I have time to add things if someone need it.

like a hacer to get host name. and stuff like that.

PM me or write me here!!

Good Bye!!
__________________
AntiBots is offline
Send a message via ICQ to AntiBots Send a message via MSN to AntiBots Send a message via Skype™ to AntiBots
Dygear
SourceMod Donor
Join Date: Apr 2004
Location: Levittown, NY
Old 01-17-2010 , 17:59   Re: Module: Sockets_hz ( listenning + nonblocking ) ... working :)
Reply With Quote #7

Quote:
Originally Posted by AntiBots View Post
Any want a update of this?? I am working and I have time to add things if someone need it.

like a hacer to get host name. and stuff like that.

PM me or write me here!!

Good Bye!!
Yeah, that would be awesome!

Code:
socket_listenfw(szAddress, iPort, SOCKET_TCP, iError, 'fwFunction');
This should also set the plugin to an automatic non-blocking mode by calling that function.

Quote:
Originally Posted by Bugsy View Post
A forward for incoming data would be nice so it can be handled as it arrives. This would eliminate the need for set_tasks\loops for socket_change checks for incoming data.
Yeah, I'm thinking about posting an enhancement request to move all of these functions into the core of AMX Mod X, as they really should of been there in the first place.

Quote:
Originally Posted by hackziner View Post
public auto_accept_reply() {
new this_chaussette;

if((this_chaussette=socket_accept(listening_s ocket))<0)
{
server_print("No pending connection")
}
else
{
new cmd[1024]
server_print("Accept/send/close")
format(cmd,1024,"Something to send")
socket_send(this_chaussette,cmd,1024)
socket_close(this_chaussette)
}

}
[/php]
Your sending this to a HTTPd server? Should you not be sending a HTTP Header?

Code:
        new cmd[1024]         server_print("Accept/send/close")         format(cmd,1024,"Something to send")         socket_send(this_chaussette,cmd,1024)         socket_close(this_chaussette)

I changed around your example, here's the code (I have no idea if this works by the way. but it does compile, so that's a plus).

Code:
#include <amxmodx> #include <sockets_hz> new g_iSocket, szAddress[] = "amxmodx.org", iPort = 80, iError; public plugin_init() {     register_plugin("Sockets Example", "0.2", "hackzinger + Dygear");     g_iSocket = socket_listen(szAddress, iPort, SOCKET_TCP, iError);     socket_unblock(g_iSocket);     set_task(1.0, "fwSocketAccept", 0, "", 0, "b"); } public plugin_end() socket_close(g_iSocket); public fwSocketAccept() {     new iSocket;     if( (iSocket = socket_accept(g_iSocket)) < 0 )         server_print("No pending connection");     else {         new szHttpReq[128], iReqSz = (sizeof(szHttpReq) - 1);         format(szHttpReq, iReqSz, "GET / HTTP/1.1^nHost: %s^n^n", szAddress);         socket_send(iSocket, szHttpReq, iReqSz);         socket_close(iSocket);     } }
__________________

Last edited by Dygear; 01-17-2010 at 18:15. Reason: Added Redone Example.
Dygear is offline
Send a message via AIM to Dygear Send a message via MSN to Dygear Send a message via Skype™ to Dygear
Old 09-18-2010, 05:32
Ramono
This message has been deleted by Ramono. Reason: Solved.
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:47.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode