Raised This Month: $106 Target: $400
 26% 

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


Post New Thread Reply   
 
Thread Tools Display Modes
hackziner
Senior Member
Join Date: Sep 2006
Location: France
Old 08-29-2007 , 15:03   Re: Module: Sockets_hz ( listenning + nonblocking ) ... working :)
Reply With Quote #11

Quote:
I don't get it, so all u have to do is call
socket_unblock(_socket)
then
socket_accept(_socket)

and it doesnt block?

or..?

Anyway, can somone compile this for win32 please?
Yep it's the good way

A little sample:
PHP Code:
#include <amxmodx>
#include <sockets_hz>

new listening_socket

public plugin_init() {
        new 
error //you're the error
        
register_plugin("demo""0.1""hackziner")
        
listening_socket socket_listen("127.0.0.1",8081,SOCKET_TCP,error)
        
socket_unblock(listening_socket)
        
server_print("LISTENNING ANY IP ON PORT %d",8081)
        
set_task(1.0,"auto_accept_reply",0,"",0,"b")
}

public 
plugin_end ()
{
        
socket_close(listening_socket//very very important !!
}

public 
auto_accept_reply() {
         new 
this_chaussette;

         if((
this_chaussette=socket_accept(listening_socket))<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)
                 }


There is little problem with a definition on win32 I'm going to check the problem ...
__________________
hackziner is offline
Send a message via ICQ to hackziner Send a message via AIM to hackziner Send a message via MSN to hackziner Send a message via Yahoo to hackziner Send a message via Skype™ to hackziner
Ramono
Veteran Member
Join Date: Nov 2005
Location: Netherlands
Old 08-29-2007 , 15:18   Re: Module: Sockets_hz ( listenning + nonblocking ) ... working :)
Reply With Quote #12

Quote:
Originally Posted by hackziner View Post
PHP Code:
public plugin_end ()
{
        
socket_close(listening_socket//very very important !!

Not realy, u can save the socket number with a protected cvar, and continue the socket after mapload.
Only if the server closes u should end the connection.
__________________
Um, hi.

Last edited by Ramono; 08-29-2007 at 15:21.
Ramono is offline
toazron1
Senior Member
Join Date: Oct 2006
Old 08-29-2007 , 15:51   Re: Module: Sockets_hz ( listenning + nonblocking ) ... working :)
Reply With Quote #13

Quote:
Originally Posted by Hawk552 View Post
Hey! You stole my old avatar!
You had this one too? I made this one so what a coincidence
__________________
toazron1 is offline
Send a message via AIM to toazron1
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 08-29-2007 , 16:01   Re: Module: Sockets_hz ( listenning + nonblocking ) ... working :)
Reply With Quote #14

Quote:
Originally Posted by Hawk552 View Post
Hey! You stole my old avatar!
omg he's right! :S ...

@hackziner - so this is similar to "In game commands" ?! Or what command("something") to send ? >.> i don't get it ...
__________________
Still...lovin' . Connor noob! Hello

Last edited by Alka; 08-29-2007 at 16:07.
Alka is offline
hackziner
Senior Member
Join Date: Sep 2006
Location: France
Old 08-30-2007 , 17:26   Re: Module: Sockets_hz ( listenning + nonblocking ) ... working :)
Reply With Quote #15

Compiled on win32
Attached Files
File Type: dll sockets_hz_amxx.dll (76.0 KB, 1547 views)
__________________
hackziner is offline
Send a message via ICQ to hackziner Send a message via AIM to hackziner Send a message via MSN to hackziner Send a message via Yahoo to hackziner Send a message via Skype™ to hackziner
Ramono
Veteran Member
Join Date: Nov 2005
Location: Netherlands
Old 09-06-2007 , 12:15   Re: Module: Sockets_hz ( listenning + nonblocking ) ... working :)
Reply With Quote #16

When a client disconnects it looks like it keeps on sending empty messages, how to make this stop? or how to make it hook whenever the client disconnects?
__________________
Um, hi.
Ramono is offline
hackziner
Senior Member
Join Date: Sep 2006
Location: France
Old 09-06-2007 , 18:08   Re: Module: Sockets_hz ( listenning + nonblocking ) ... working :)
Reply With Quote #17

socket_close ?

"woof" ( sorry i don't know the right word) or packet ?

I'm going to have a look at this ...

(I'm working on a http server too)
__________________
hackziner is offline
Send a message via ICQ to hackziner Send a message via AIM to hackziner Send a message via MSN to hackziner Send a message via Yahoo to hackziner Send a message via Skype™ to hackziner
Ramono
Veteran Member
Join Date: Nov 2005
Location: Netherlands
Old 09-13-2007 , 04:34   Re: Module: Sockets_hz ( listenning + nonblocking ) ... working :)
Reply With Quote #18

Quote:
Originally Posted by hackziner View Post
(I'm working on a http server too)

You can make a FastDownload Plugin if you want, Imma stop tryina do it.
TF2 and Fortress forever coming, so the next months I won't have time, and if i do I will try to script for sourcemod.
__________________
Um, hi.
Ramono is offline
Lo6idZe
Member
Join Date: May 2008
Old 10-28-2008 , 11:33   Re: Module: Sockets_hz ( listenning + nonblocking ) ... working :)
Reply With Quote #19

Can I use this for AMXX 1.81? Or I need to change something in code?
Lo6idZe is offline
hip_hop_x
Senior Member
Join Date: Apr 2006
Old 12-15-2008 , 05:54   Re: Module: Sockets_hz ( listenning + nonblocking ) ... working :)
Reply With Quote #20

thank you for compiling the socket module for win32 ;)
hip_hop_x is offline
Send a message via MSN to hip_hop_x Send a message via Yahoo to hip_hop_x
Reply


Thread Tools
Display Modes

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 14:17.


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