Raised This Month: $51 Target: $400
 12% 

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


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

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
 



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 23:33.


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