PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

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)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

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
Comments
Atom
Comments

Copyright © PHPFixing