Raised This Month: $ Target: $400
 0% 

[EXTENSION] Socket (3.0.1)


Post New Thread Reply   
 
Thread Tools Display Modes
gabr1ell
Junior Member
Join Date: Jul 2019
Old 08-13-2020 , 12:01   Re: [EXTENSION] Socket (3.0.1)
Reply With Quote #561

I'm having trouble compiling the version of JoinedSenses (https://github.com/JoinedSenses/sm-ext-socket) can someone who compiled send me?

Thanks
gabr1ell is offline
JoinedSenses
Senior Member
Join Date: Sep 2013
Old 09-14-2020 , 01:42   Re: [EXTENSION] Socket (3.0.1)
Reply With Quote #562

https://github.com/JoinedSenses/sm-ext-socket/releases

No need to compile
__________________
JoinedSenses is offline
ZASTRELIS
Veteran Member
Join Date: Nov 2010
Location: Siberia, Irkutsk
Old 01-09-2021 , 12:20   Re: [EXTENSION] Socket (3.0.1)
Reply With Quote #563

Code:
public void OnSocketIncoming(Socket socket, Socket newSocket, const char[] remoteIP, int remotePort, any arg) {         PrintToServer("%s:%d connected", remoteIP, remotePort);     // setup callbacks required to 'enable' newSocket     // newSocket won't process data until these callbacks are set     newSocket.SetReceiveCallback(OnChildSocketReceive);     newSocket.SetDisconnectCallback(OnChildSocketDisconnected);     newSocket.SetErrorCallback(OnChildSocketError);     newSocket.Send("send quit to quit\n"); }

remoteIP always null for latest build for winos

Last edited by ZASTRELIS; 01-09-2021 at 13:03.
ZASTRELIS is offline
ZASTRELIS
Veteran Member
Join Date: Nov 2010
Location: Siberia, Irkutsk
Old 01-09-2021 , 14:02   Re: [EXTENSION] Socket (3.0.1)
Reply With Quote #564

SOURCE CODE
Can't send correct response for serverEx command to the receiver.. or it's possible only in OnSocketIncoming?

I tried to send command from my site, it works by OnChildSocketReceive but in this CB I can't response to my request using command buffer

P.S. I found that it works, but sometimes.. How send with same frame as callback?

Solved by: socket.SetOption(SocketLinger, 1);

P.S.S. I'm not understood why I must close socket handle after when every ReceiveCallback will be finished

Last edited by ZASTRELIS; 01-09-2021 at 18:11.
ZASTRELIS is offline
ZASTRELIS
Veteran Member
Join Date: Nov 2010
Location: Siberia, Irkutsk
Old 01-10-2021 , 08:23   Re: [EXTENSION] Socket (3.0.1)
Reply With Quote #565

how to decode post via sm?

Last edited by ZASTRELIS; 01-10-2021 at 08:24.
ZASTRELIS is offline
DJ Tsunami
DJ Post Spammer
Join Date: Feb 2008
Location: The Netherlands
Old 01-10-2021 , 08:49   Re: [EXTENSION] Socket (3.0.1)
Reply With Quote #566

Use an HTTP extension like SteamWorks or REST in Pawn.
__________________
Advertisements | REST in Pawn - HTTP client for JSON REST APIs
I do not provide support in PMs. Please use the forum thread.
DJ Tsunami is offline
ZASTRELIS
Veteran Member
Join Date: Nov 2010
Location: Siberia, Irkutsk
Old 01-10-2021 , 09:06   Re: [EXTENSION] Socket (3.0.1)
Reply With Quote #567

Quote:
Originally Posted by DJ Tsunami View Post
Use an HTTP extension like SteamWorks or REST in Pawn.
can you tell more precisely which method you know for this? because I looked into steamworks and json and not found urldecode methods..

Last edited by ZASTRELIS; 01-10-2021 at 09:09.
ZASTRELIS is offline
ZASTRELIS
Veteran Member
Join Date: Nov 2010
Location: Siberia, Irkutsk
Old 01-10-2021 , 11:12   Re: [EXTENSION] Socket (3.0.1)
Reply With Quote #568

I'm nothing to understand in how to build extensions for sm, so I write my own simple URLDecode method for replacing percent characters
Code:
for(int i = 0; i < sizeof(symbols); ++i) {     if(StrContains(receiveData[ch+6], symbols[i][1], false) != -1)     {         ReplaceString(receiveData, dataSize, symbols[i][1], symbols[i][0], false);     } }
But I know that in C++ and Boost it will be works faster.. so I will be waiting for normal URLDecode for UTF-8 w Cyrilic support..
P.S. this source was very helpful https://urldecoder.org/
P.S.S. for courteous Russians: https://snipp.ru/handbk/url-code

Last edited by ZASTRELIS; 01-16-2021 at 03:40. Reason: all works fine, my problem
ZASTRELIS is offline
ZASTRELIS
Veteran Member
Join Date: Nov 2010
Location: Siberia, Irkutsk
Old 01-14-2021 , 10:37   Re: [EXTENSION] Socket (3.0.1)
Reply With Quote #569

this an example for writing the file, how about sending file in response for OnChildSocketReceive? This responses' size over 20KB..

Last edited by ZASTRELIS; 01-14-2021 at 12:42.
ZASTRELIS 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 12:39.


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