AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Module Coding (https://forums.alliedmods.net/forumdisplay.php?f=9)
-   -   Module: Sockets_hz ( listenning + nonblocking ) ... working :) (https://forums.alliedmods.net/showthread.php?t=60026)

hackziner 08-29-2007 14:03

Re: Module: Sockets_hz ( listenning + nonblocking ) ... working :)
 
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 ...

Ramono 08-29-2007 14:18

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

Originally Posted by hackziner (Post 524901)
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.

toazron1 08-29-2007 14:51

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

Originally Posted by Hawk552 (Post 524855)
Hey! You stole my old avatar!

You had this one too? I made this one so what a coincidence :)

Alka 08-29-2007 15:01

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

Originally Posted by Hawk552 (Post 524855)
Hey! You stole my old avatar!

omg he's right! :S ...

@hackziner - so this is similar to "In game commands" :D ?! Or what command("something") to send ? >.> i don't get it :| ...

hackziner 08-30-2007 16:26

Re: Module: Sockets_hz ( listenning + nonblocking ) ... working :)
 
1 Attachment(s)
Compiled on win32

Ramono 09-06-2007 11:15

Re: Module: Sockets_hz ( listenning + nonblocking ) ... working :)
 
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?

hackziner 09-06-2007 17:08

Re: Module: Sockets_hz ( listenning + nonblocking ) ... working :)
 
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)

Ramono 09-13-2007 03:34

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

Originally Posted by hackziner (Post 528058)
(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.

Lo6idZe 10-28-2008 10:33

Re: Module: Sockets_hz ( listenning + nonblocking ) ... working :)
 
Can I use this for AMXX 1.81? Or I need to change something in code?

hip_hop_x 12-15-2008 04:54

Re: Module: Sockets_hz ( listenning + nonblocking ) ... working :)
 
thank you for compiling the socket module for win32 ;)


All times are GMT -4. The time now is 19:09.

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