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

[TUT] Introduction to sockets


Post New Thread Reply   
 
Thread Tools Display Modes
loiraolhosazul
Member
Join Date: May 2020
Old 07-22-2021 , 22:16   Re: [TUT] Introduction to sockets
Reply With Quote #21

this module is better than this version, right? https://amxmodx-es.com/showthread.php?tid=8178
loiraolhosazul is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-22-2021 , 23:17   Re: [TUT] Introduction to sockets
Reply With Quote #22

The native sockets are blocking sockets which isn't ideal for a game server. What you linked are non-blocking/asynchronous, which are better for gameplay,
__________________
Bugsy is offline
loiraolhosazul
Member
Join Date: May 2020
Old 07-23-2021 , 10:25   Re: [TUT] Introduction to sockets
Reply With Quote #23

Quote:
Originally Posted by Bugsy View Post
The native sockets are blocking sockets which isn't ideal for a game server. What you linked are non-blocking/asynchronous, which are better for gameplay,
why don't you 'update' your socket?
loiraolhosazul is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-25-2021 , 15:12   Re: [TUT] Introduction to sockets
Reply With Quote #24

I suppose the native sockets could be updated to be non-blocking by default. But you run the risk of breaking existing plugins that use the module with it's existing functionality. In this case, the risk should be low as nobody should have designed their plugin with a freeze/lag that would be caused by blocking sockets.
__________________
Bugsy is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 07-25-2021 , 16:31   Re: [TUT] Introduction to sockets
Reply With Quote #25

Quote:
Originally Posted by Bugsy View Post
The native sockets are blocking sockets which isn't ideal for a game server. What you linked are non-blocking/asynchronous, which are better for gameplay,
Code:
g_Weather_Feed = socket_open("api.openweathermap.org", 80, SOCKET_TCP, Soc_O_ErroR2, SOCK_NON_BLOCKING|SOCK_LIBC_ERRORS);
https://www.amxmodx.org/api/sockets/socket_open

Is the documentation wrong then about being able to flag it for non_blocking?
__________________
DJEarthQuake is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-25-2021 , 17:47   Re: [TUT] Introduction to sockets
Reply With Quote #26

I didn't realize that was there, maybe it was a 1.9.0 addon? Cool, nonetheless.
__________________
Bugsy is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 07-26-2021 , 13:25   Re: [TUT] Introduction to sockets
Reply With Quote #27

What I think I did was copy over the include file from 1.9 into 1.82 to compile without having to make 2 lines of code on the socket declaration. 1.82 is not likely non-blocking.
__________________

Last edited by DJEarthQuake; 09-19-2021 at 07:56. Reason: Updated after reinstall
DJEarthQuake is offline
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 15:36.


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