PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0
Showing posts with label indy. Show all posts
Showing posts with label indy. Show all posts

Friday, October 21, 2022

[FIXED] How to get the number of client and the connect/disconnect events in Synapse ?

 October 21, 2022     ararat-synapse, delphi, indy, sockets, tcp     No comments   

Issue

I'm trying to use Synapse(TTCPBlockSocket) instead of Indy,but through the official help and demo i can't understand how to get the number of TCP client,and i didn't found the connect/disconnect events about Synapse,please give me some hint or sample code. Thanks in advance !


Solution

As TLama notes in the comments, each incoming connection shuold fire the OnStatus event with HR_Accept. If I look over the TBlockSocket source, each disconnect, either by protocol or by error, should fire an OnStatus event with the HR_SocketClose reason on the connection socket.



Answered By - Stijn Sanders
Answer Checked By - Katrina (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Tuesday, September 13, 2022

[FIXED] What is FIONBIO value for iOS, to Block/Unblock Sockets?

 September 13, 2022     cross-platform, delphi, indy, ios, websocket     No comments   

Issue

I've been working with the cross-platform Websocket client, based on the Indy TIdHTTP component, found here.

The client, TIdHTTPWebSocketClient, internally uses TIdWebSocketMultiReadThread; the latter creates a non-blocking socket (InitSpecialEventSocket method) by using Indy's GStack IOControl to access ioctl.

The code, downloaded from github, works for Windows, but failed on Android; FIONBIO had to be changed to $5421.

I'm currently unable to test on iOS, and wish to know if others have managed to get TIdHTTPWebSocketClient to work on this platform, and what value of FIONBIO should be used.

Thanks in advance.


Solution

FIONBIO applies to ioctlsocket() on Windows and ioctl() on POSIX.

On POSIX, you can alternatively specify the SOCK_NONBLOCK flag when creating a socket, or set the O_NONBLOCK flag on a socket using fcntl(F_SETFL).

Note that Indy does have an AOverlapped (non-blocking) parameter on the TIdStack.NewSocketHandle() and TIdStackBSDBase.WSSocket() methods, and a TIdStackBSDBase.SetBlocking() method, but they are not currently implemented for non-Windows platforms (code has been written for them, but has not been checked in).



Answered By - Remy Lebeau
Answer Checked By - Gilberto Lyons (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Older Posts Home
View mobile version

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
All Comments
Atom
All Comments

Copyright © PHPFixing