B4i Library SD: iHttpServer (beta)

I started developing a version of the HttpServer Library for iOs. It is still a beta version and not complete, but already functional. You can start using it to test it. Includes WebSocket and QueryElement implementation
Digest Auth will be added in the future. I have arrived at a first version of the server that allows Digest authentication.
NEW: I have arrived at a first version of the server that allows Digest authentication. It is not included in the distributed version
It is entirely written in B4i, it depends on the iNetwork library

The library has been updated to be cross-platform and you can find it in this THREAD


iHttpServer

Author:
Star-Dust
Version: 0.72
  • QueryElement
    • Events:
      • change (Resp As ServletResponse, Params As Map) ' QueryElement Event Click
      • click (Resp As ServletResponse, Params As Map) ' QueryElement Event Click
      • dblclick (Resp As ServletResponse, Params As Map) ' QueryElement Event Click
      • focus (Resp As ServletResponse, Params As Map) ' QueryElement Event Click
      • focusin (Resp As ServletResponse, Params As Map) ' QueryElement Event Click
      • focusout (Resp As ServletResponse, Params As Map) ' QueryElement Event Click
      • keyup (Resp As ServletResponse, Params As Map) ' QueryElement Event Click
      • mousedown (Resp As ServletResponse, Params As Map) ' QueryElement Event Click
      • mouseenter (Resp As ServletResponse, Params As Map) ' QueryElement Event Click
      • mouseleave (Resp As ServletResponse, Params As Map) ' QueryElement Event Click
      • mousemove (Resp As ServletResponse, Params As Map) ' QueryElement Event Click
      • mouseup (Resp As ServletResponse, Params As Map) ' QueryElement Event Click
    • Fields:
      • Event_change As NSString*
      • Event_click As NSString*
      • Event_dblclick As NSString*
      • Event_focus As NSString*
      • Event_focusin As NSString*
      • Event_focusout As NSString*
      • Event_keyup As NSString*
      • Event_mousedown As NSString*
      • Event_mouseenter As NSString*
      • Event_mouseleave As NSString*
      • Event_mousemove As NSString*
      • Event_mouseup As NSString*
      • NoEvent As B4IMap*()
    • Functions:
      • Class_Globals As NSString*
      • CreateEvent (ObjectName As NSString*, Event As NSString*, OtherEvent As B4IMap*()) As B4IMap*()
      • Eval (Script As NSString*, Params As B4IList*) As NSString*
      • EvalWithResult (Script As NSString*, Params As B4IList*) As NSString*
      • Initialize (ba As B4I*, Response As B4i_servletresponse*) As NSString*
        Initializes the object. You can add parameters to this method if needed.
      • IsInitialized As BOOL
        Verifica se l'oggetto sia stato inizializzato.
      • RunFunction (function As NSString*, ID As NSString*, Params As B4IList*) As NSString*
        Param = list or array: array as Object is wrong - array as Map is correct
      • RunFunctionWithResult (function As NSString*, ID As NSString*, Params As B4IList*) As NSString*
      • RunMethod (Method As NSString*, ID As NSString*, Params As B4IList*) As NSString*
        Param = list or array: array as Object is wrong - array as Map is correct
      • RunMethodWithResult (Method As NSString*, ID As NSString*, Params As B4IList*) As NSString*
        Param = list or array: array as Object is wrong - array as Map is correct
      • SelectElement (ID As NSString*) As NSString*
      • SetCommand (etype As NSString*, Method As NSString*, property As NSString*, ID As NSString*, Params As B4IList*, Arg As B4IList*) As NSString*
      • SetCSS (id As NSString*, Params As B4IList*) As NSString*
      • SetHtml (id As NSString*, Params As B4IList*) As NSString*

        Public Sub SetHeight (Value As String)
        End Sub
      • SetPropriety (Property As NSString*, Value As B4IList*) As NSString*
    • Properties:
      • AutomaticEvents
  • ServletRequest
    • Fields:
      • CharacterEncoding As NSString*
      • ConnectionAlive As BOOL
      • ContentLength As Long long
      • ContentType As NSString*
      • ID As NSString*
      • LogActive As BOOL
      • LogFirstRefuse As BOOL
      • MultipartFilename As B4IMap*
      • RequestCookies As B4IMap*
      • RequestHeader As B4IMap*
      • RequestParameter As B4IMap*
      • Timeout As Long long
    • Functions:
      • Class_Globals As NSString*
      • Close As NSString*
      • Connected As BOOL
      • GetHeader (Name As NSString*) As NSString*
      • GetHeadersName As NSObject*
        can be used to iterate over Header
        Example
        <code>
        For Each Name As String In ServletRequest.GetHeadersName
        Log("Value = " & ServletRequest.GetHeader(Name))
        Next</code>
      • GetInputStream As B4IInputStream*
      • GetMethod As NSString*
      • GetRequestHOST As NSString*
      • GetRequestURI As NSString*
      • GetWebSocketCompressDeflateAccept As BOOL
      • GetWebSocketCompressGzipAccept As BOOL
      • GetWebSocketMapData As B4IMap*
      • GetWebSocketStringData As NSString*
      • Initialize (ba As B4I*, CallBack As NSObject*, EventName As NSString*, Sck As B4ISocketWrapper*) As NSString*
        Initializes the object. You can add parameters to this method if needed.
      • IsInitialized As BOOL
        Verifica se l'oggetto sia stato inizializzato.
      • ParameterMap As B4IMap*
      • RemoteAddress As NSString*
      • RemotePort As Int
  • ServletResponse
    • Fields:
      • CharacterEncoding As NSString*
      • ContentLenght As Int
      • ContentType As NSString*
      • Status As Int
    • Functions:
      • Class_Globals As NSString*
      • Close As NSString*
      • Connected As BOOL
      • Initialize (ba As B4I*, Req As B4i_servletrequest*, ast As B4IAsyncStreams*, Sck As B4ISocketWrapper*) As NSString*
        Initializes the object. You can add parameters to this method if needed.
      • IsInitialized As BOOL
        Verifica se l'oggetto sia stato inizializzato.
      • ResetCookies As NSString*
      • SendFile (Dir As NSString*, fileName As NSString*) As NSString*
        don't use DirAssets
      • SendFile2 (Dir As NSString*, fileName As NSString*, Content_Type As NSString*) As NSString*
      • SendNotFound (filenameNotFound As NSString*) As NSString*
      • SendRaw (Data As Unsigned char()) As NSString*
      • SendRedirect (Address As NSString*) As NSString*
      • SendString (Text As NSString*) As NSString*
        sending text with Header
      • SendWebSocketBinary (Data As Unsigned char(), Masked As BOOL) As NSString*
      • SendWebSocketClose As NSString*
      • SendWebSocketPing As NSString*
      • SendWebSocketPong As NSString*
      • SendWebSocketString (Text As NSString*, Masked As BOOL, Compressed As NSString*) As NSString*
        Cmpressed as Deflate=zlib, gzip, none - (set always none)
      • SetCookies (Name As NSString*, Value As NSString*) As NSString*
        Set Cokies values on Browser
      • SetHeader (Name As NSString*, Value As NSString*) As NSString*
      • Write (Text As NSString*) As NSString*
        Sending text without header to dynamically send more text after the SendString
    • Properties:
      • OutputStream As B4IOutputStream* [read only]
      • Query As B4i_queryelement* [read only]
  • httpServer
    • Events:
      • Handle (req As ServletRequest, resp As ServletResponse)
      • HandleWebSocket (req As ServletRequest, resp As ServletResponse)
      • NewConection (req As ServletRequest)
      • SwitchToWebSocket (req As ServletRequest, resp As ServletResponse)
      • UploadedFile (req As ServletRequest, resp As ServletResponse)
      • UploadProgress (resp As ServletResponse, Progress As Float) ' Progress = 0-1
      • WebSocketClose (CloseCode As Int, CloseMessage As String)
    • Fields:
      • DigestAuthentication As BOOL
      • DigestPath As NSString*
      • htdigest As B4IList*
      • IgnoreNC As BOOL
      • realm As NSString*
      • Timeout As Int
    • Functions:
      • Class_Globals As NSString*
      • GetMyIP As NSString*
      • GetMyWifiIp As NSString*
      • Initialize (ba As B4I*, CallBack As NSObject*, EventName As NSString*) As NSString*
        Initializes the object. You can add parameters to this method if needed.
      • IsInitialized As BOOL
        Verifica se l'oggetto sia stato inizializzato.
      • Start (Port As Int)
        eg. Start(51051)
      • Stop As NSString*

Sample
ezgif.com-optimize.gif video2.gif
 
Last edited:

Waldemar Lima

Well-Known Member
Licensed User
If you use the personal builder you have to copy the .h libraries
Which example are you trying, the one with webSocket or the one with just HTTP?
trying build on b4i Hosted Builder
i am trying both examples ...

the websocket example shows this error:
B4X:
B4i Version: 7.20
Parsing code.    (0.01s)
Building folders structure.    (0.04s)
Compiling code.    (0.02s)
Compiling layouts code.    (0.00s)
Compiling debugger engine code.    (0.91s)
Building Xcode project.    (0.13s)
Preparing project for builder.    (0.03s)
    Project size: 0.16 MB
Sending data to remote compiler.    Error
B4i line: 266
Resp.Query.RunMethodWithResult(\
no visible @interface for 'b4i_servletresponse' declares the selector '_getquery'
 
Last edited:

Star-Dust

Expert
Licensed User
trying build on b4i Hosted Builder
i am trying both examples ...

the websocket example shows this error:
B4X:
B4i Version: 7.20
Parsing code.    (0.01s)
Building folders structure.    (0.04s)
Compiling code.    (0.02s)
Compiling layouts code.    (0.00s)
Compiling debugger engine code.    (0.91s)
Building Xcode project.    (0.13s)
Preparing project for builder.    (0.03s)
    Project size: 0.16 MB
Sending data to remote compiler.    Error
B4i line: 266
Resp.Query.RunMethodWithResult(\
no visible @interface for 'b4i_servletresponse' declares the selector '_getquery'
I can't understand the problem, I have tested it again and it works fine for me. It seems that no methods are found by you or they are considered confidential and not accessible.

I need to do more research, I can't help you at the moment
 

Star-Dust

Expert
Licensed User
NOTICE
The library has been updated to be cross-platform and you can find it in this THREAD
 

Star-Dust

Expert
Licensed User
B4X:
B4i Version: 7.20
Parsing code.    (0.00s)
Building folders structure.    (0.05s)
Compiling code.    (0.01s)
Compiling layouts code.    (0.00s)
Compiling debugger engine code.    (0.02s)
Building Xcode project.    (0.22s)
Preparing project for builder.    (0.03s)
    Project size: 0.16 MB
Sending data to remote compiler.    Error
B4i line: 33
Private Svr As httpServer
unknown receiver 'b4i_httpserver'; did you mean 'b4i_server'?

Out: Command line invocation:
    /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -configuration Release PRODUCT_NAME=HttpServer CONFIGURATION_BUILD_DIR=/Users/administrator/Documents/UploadedProjects/<user id>/Payload "CODE_SIGN_IDENTITY=iPhone Distribution: xxxxxx" "OTHER_CODE_SIGN_FLAGS=--keychain <user id>" PROVISIONING_PROFILE=d3f9e6ea-9623-4c4a-94a6-d2d721c9a402 -arch arm64

Build settings from command line:
    ARCHS = arm64
    CODE_SIGN_IDENTITY = iPhone Distribution: xxx
    CONFIGURATION_BUILD_DIR = /Users/administrator/Documents/UploadedProjects/<user id>/Payload
    OTHER_CODE_SIGN_FLAGS = --keychain <user id>
    PRODUCT_NAME = HttpServer
    PROVISIONING_PROFILE = xxxxx

note: Using new build system
note: Using codesigning identity override: iPhone Distribution:xxxx
note: Planning build
note: Constructing build description
warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.3.99. (in target 'B4iProject' from project 'B4iProject')
CreateBuildDirectory /Users/administrator/Documents/UploadedProjects/<user id>/build (in target 'B4iProject' from project 'B4iProject')
    cd /Users/administrator/Documents/UploadedProjects/<user id>
    builtin-create-build-directory /Users/administrator/Documents/UploadedProjects/<user id>/build

MkDir /Users/administrator/Documents/UploadedProjects/<user id>/Payload/HttpServer.app (in target 'B4iProject' from project 'B4iProject')
    cd /Users/administrator/Documents/UploadedProjects/<user id>
    /bin/mkdir -p /Users/administrator/Documents/UploadedProjects/<user id>/Payload/HttpServer.app

ProcessProductPackaging /Users/administrator/Library/MobileDevice/Provisioning\ Profiles/d3f9e6ea-9623-4c4a-94a6-d2d721c9a402.mobileprovision /Users/administrator/Documents/UploadedProjects/<user id>/Payload/HttpServer.app/embedded.mobileprovision (in target 'B4iProject' from project 'B4iProject')
    cd /Users/administrator/Documents/UploadedProjects/<user id>
    builtin-productPackagingUtility /Users/administrator/Library/MobileDevice/Provisioning\ Profiles/d3f9e6ea-9623-4c4a-94a6-d2d721c9a402.mobileprovision -o /Users/administrator/Documents/UploadedProjects/<user id>/Payload/HttpServer.app/embedded.mobileprovision

WriteAuxiliaryFile /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/DerivedSources/Entitlements.plist (in target 'B4iProject' from project 'B4iProject')
    cd /Users/administrator/Documents/UploadedProjects/<user id>
    write-file /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/DerivedSources/Entitlements.plist

ProcessProductPackaging "" /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/HttpServer.app.xcent (in target 'B4iProject' from project 'B4iProject')
    cd /Users/administrator/Documents/UploadedProjects/<user id>


Entitlements:

{
    "application-identifier" = "xxxx.b4i.httpserver";
    "com.apple.developer.team-identifier" = xxxx;
    "get-task-allow" = 0;
}


    builtin-productPackagingUtility -entitlements -format xml -o /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/HttpServer.app.xcent

WriteAuxiliaryFile /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/HttpServer-project-headers.hmap (in target 'B4iProject' from project 'B4iProject')
    cd /Users/administrator/Documents/UploadedProjects/<user id>
    write-file /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/HttpServer-project-headers.hmap

WriteAuxiliaryFile /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/HttpServer-own-target-headers.hmap (in target 'B4iProject' from project 'B4iProject')
    cd /Users/administrator/Documents/UploadedProjects/<user id>
    write-file /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/HttpServer-own-target-headers.hmap

WriteAuxiliaryFile /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/HttpServer-generated-files.hmap (in target 'B4iProject' from project 'B4iProject')
    cd /Users/administrator/Documents/UploadedProjects/<user id>
    write-file /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/HttpServer-generated-files.hmap

WriteAuxiliaryFile /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/HttpServer-all-target-headers.hmap (in target 'B4iProject' from project 'B4iProject')
    cd /Users/administrator/Documents/UploadedProjects/<user id>
    write-file /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/HttpServer-all-target-headers.hmap

WriteAuxiliaryFile /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/HttpServer.hmap (in target 'B4iProject' from project 'B4iProject')
    cd /Users/administrator/Documents/UploadedProjects/<user id>
    write-file /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/HttpServer.hmap

WriteAuxiliaryFile /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/all-product-headers.yaml (in target 'B4iProject' from project 'B4iProject')
    cd /Users/administrator/Documents/UploadedProjects/<user id>
    write-file /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/all-product-headers.yaml

WriteAuxiliaryFile /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/HttpServer-all-non-framework-target-headers.hmap (in target 'B4iProject' from project 'B4iProject')
    cd /Users/administrator/Documents/UploadedProjects/<user id>
    write-file /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/HttpServer-all-non-framework-target-headers.hmap

WriteAuxiliaryFile /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/arm64/HttpServer.LinkFileList (in target 'B4iProject' from project 'B4iProject')
    cd /Users/administrator/Documents/UploadedProjects/<user id>
    write-file /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/arm64/HttpServer.LinkFileList

CompileC /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/arm64/LS_page1.o /Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/LS_page1.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target 'B4iProject' from project 'B4iProject')
    cd /Users/administrator/Documents/UploadedProjects/<user id>
    export LANG\=en_US.US-ASCII
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -target arm64-apple-ios8.0 -fmessage-length\=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit\=0 -std\=gnu99 -fobjc-arc -fmodules -gmodules -fmodules-prune-interval\=86400 -fmodules-prune-after\=345600 -fbuild-session-file\=/var/folders/lj/wrbzzxds6b53f88_rx3x7c800000gn/C/org.llvm.clang/ModuleCache.noindex/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror\=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Werror\=return-type -Wno-implicit-atomic-properties -Werror\=deprecated-objc-isa-usage -Wno-objc-interface-ivars -Werror\=objc-root-class -Wno-arc-repeated-use-of-weak -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wno-non-literal-null-conversion -Wno-objc-literal-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wno-deprecated-implementations -DB4I_VERSION\=13 -DNS_BLOCK_ASSERTIONS\=1 -DOBJC_OLD_DISPATCH_PROTOTYPES\=1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.3.sdk -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -fvisibility\=hidden -Wno-sign-conversion -Wno-infinite-recursion -Wno-comma -Wno-block-capture-autoreleasing -Wno-strict-prototypes -Wno-semicolon-before-method-body -iquote /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/HttpServer-generated-files.hmap -I/Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/HttpServer-own-target-headers.hmap -I/Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/HttpServer-all-target-headers.hmap -iquote /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/HttpServer-project-headers.hmap -I/Users/administrator/Documents/UploadedProjects/<user id>/Payload/include -I/Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/DerivedSources-normal/arm64 -I/Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/DerivedSources/arm64 -I/Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/DerivedSources -F/Users/administrator/Documents/UploadedProjects/<user id>/Payload -F../../Libs -MMD -MT dependencies -MF /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/arm64/LS_page1.d --serialize-diagnostics /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/arm64/LS_page1.dia -c /Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/LS_page1.m -o /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/arm64/LS_page1.o

CompileC /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/arm64/b4i_main.o /Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_main.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target 'B4iProject' from project 'B4iProject')
    cd /Users/administrator/Documents/UploadedProjects/<user id>
    export LANG\=en_US.US-ASCII
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -target arm64-apple-ios8.0 -fmessage-length\=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit\=0 -std\=gnu99 -fobjc-arc -fmodules -gmodules -fmodules-prune-interval\=86400 -fmodules-prune-after\=345600 -fbuild-session-file\=/var/folders/lj/wrbzzxds6b53f88_rx3x7c800000gn/C/org.llvm.clang/ModuleCache.noindex/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror\=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Werror\=return-type -Wno-implicit-atomic-properties -Werror\=deprecated-objc-isa-usage -Wno-objc-interface-ivars -Werror\=objc-root-class -Wno-arc-repeated-use-of-weak -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wno-non-literal-null-conversion -Wno-objc-literal-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wno-deprecated-implementations -DB4I_VERSION\=13 -DNS_BLOCK_ASSERTIONS\=1 -DOBJC_OLD_DISPATCH_PROTOTYPES\=1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.3.sdk -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -fvisibility\=hidden -Wno-sign-conversion -Wno-infinite-recursion -Wno-comma -Wno-block-capture-autoreleasing -Wno-strict-prototypes -Wno-semicolon-before-method-body -iquote /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/HttpServer-generated-files.hmap -I/Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/HttpServer-own-target-headers.hmap -I/Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/HttpServer-all-target-headers.hmap -iquote /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/HttpServer-project-headers.hmap -I/Users/administrator/Documents/UploadedProjects/<user id>/Payload/include -I/Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/DerivedSources-normal/arm64 -I/Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/DerivedSources/arm64 -I/Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/DerivedSources -F/Users/administrator/Documents/UploadedProjects/<user id>/Payload -F../../Libs -MMD -MT dependencies -MF /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/arm64/b4i_main.d --serialize-diagnostics /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/arm64/b4i_main.dia -c /Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_main.m -o /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/arm64/b4i_main.o
In file included from /Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_main.m:2:
/Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_main.h:16:9: error: unknown type name 'b4i_httpserver'; did you mean 'b4i_server'?
@public b4i_httpserver* __svr;
        ^~~~~~~~~~~~~~
        b4i_server
In file included from /Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_main.m:2:
In file included from /Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_main.h:5:
/Users/administrator/Documents/Libs/iHttpServer.h:79:8: note: 'b4i_server' declared here
@class b4i_server;
       ^
In file included from /Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_main.m:2:
/Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_main.h:31:22: error: unknown type name 'b4i_httpserver'; did you mean 'b4i_server'?
@property (nonatomic)b4i_httpserver* _svr;
                     ^~~~~~~~~~~~~~
                     b4i_server
In file included from /Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_main.m:2:
In file included from /Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_main.h:5:
/Users/administrator/Documents/Libs/iHttpServer.h:79:8: note: 'b4i_server' declared here
@class b4i_server;
       ^
/Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_main.m:127:16: error: unknown receiver 'b4i_httpserver'; did you mean 'b4i_server'?
self->__svr = [b4i_httpserver new];
               ^~~~~~~~~~~~~~
               b4i_server
In file included from /Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_main.m:2:
In file included from /Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_main.h:5:
/Users/administrator/Documents/Libs/iHttpServer.h:79:8: note: 'b4i_server' declared here
@class b4i_server;
       ^
/Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_main.m:164:8: error: no visible @interface for 'b4i_servletresponse' declares the selector '_sendfile::'
[_resp _sendfile:[[self->___c File] DirTemp] :_fn];
~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_main.m:172:8: error: no visible @interface for 'b4i_servletresponse' declares the selector '_sendnotfound:'
[_resp _sendnotfound:_fn];
~~~~~ ^~~~~~~~~~~~~
/Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_main.m:178:12: error: 'b4i_servletrequest' does not have a member named '__contenttype'
if ([_req->__contenttype isEqual:@"multipart/form-data"]) {
     ~~~~  ^
/Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_main.m:181:12: error: 'b4i_servletrequest' does not have a member named '__multipartfilename'
if ([_req->__multipartfilename Size]>0) {
     ~~~~  ^
/Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_main.m:185:40: error: 'b4i_servletrequest' does not have a member named '__multipartfilename'
const id<B4IIterable> group16 = [_req->__multipartfilename Keys];
                                 ~~~~  ^
/Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_main.m:217:8: error: no visible @interface for 'b4i_servletresponse' declares the selector '_sendstring:'
[_resp _sendstring:[@[_field,(@"<B>Recorded data</B><BR><a href=\"/index.html\">Back</a>")] componentsJoinedByString:@""]];
~~~~~ ^~~~~~~~~~~
/Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_main.m:240:7: error: 'b4i_servletrequest' does not have a member named '__id'
_req->__id = [self.bi NumberToString:@(self->__counterconenction)];
~~~~  ^
/Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_main.m:262:12: error: 'b4i_servletrequest' does not have a member named '__multipartfilename'
if ([_req->__multipartfilename Size]>0) {
     ~~~~  ^
/Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_main.m:266:39: error: 'b4i_servletrequest' does not have a member named '__multipartfilename'
const id<B4IIterable> group4 = [_req->__multipartfilename Keys];
                                ~~~~  ^
/Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_main.m:274:48: error: 'b4i_servletrequest' does not have a member named '__multipartfilename'
_tempfilename = [self.bi ObjectToString:[_req->__multipartfilename Get:(NSObject*)(_filename)]];
                                         ~~~~  ^
/Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_main.m:292:8: error: no visible @interface for 'b4i_servletresponse' declares the selector '_sendstring:'
[_resp _sendstring:([@[@"<!DOCTYPE html>\n",@"<html lang=\"en\" dir=\"ltr\">\n",@"\n",@"<head>\n",@"  <meta charset=\"utf-8\">\n",@"  <title>UPload</title>\n",@"</head>\n",@"\n",@"<body id=\"body\">\n",@"<B>Download: ",[self->___c SmartStringFormatter:@"" :(NSObject*)(_filename)],@"</B><BR>\n",@"<img src=\"",[self->___c SmartStringFormatter:@"" :(NSObject*)(_tempfilename)],@"\"><BR>\n",@"<a href=\"/fileupload.html\">Back To Upload</a><BR>\n",@"<a href=\"/index.html\">Back To Home</a>\n",@"</body>\n",@"</html>"] componentsJoinedByString:@""])];
~~~~~ ^~~~~~~~~~~
/Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_main.m:299:8: error: no visible @interface for 'b4i_servletresponse' declares the selector '_sendstring:'
[_resp _sendstring:([@[@"<!DOCTYPE html>\n",@"<html lang=\"en\" dir=\"ltr\">\n",@"\n",@"<head>\n",@"  <meta charset=\"utf-8\">\n",@"  <title>UPload</title>\n",@"</head>\n",@"\n",@"<body id=\"body\">\n",@"<B>Download: ",[self->___c SmartStringFormatter:@"" :(NSObject*)(_filename)],@"</B><BR>\n",@"<a href=\"/fileupload.html\">Back to Upload</a><BR>\n",@"<a href=\"/index.html\">Back to Home</a>\n",@"</body>\n",@"</html>"] componentsJoinedByString:@""])];
~~~~~ ^~~~~~~~~~~
15 errors generated.

CompileC /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/arm64/main.o /Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/main.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target 'B4iProject' from project 'B4iProject')
    cd /Users/administrator/Documents/UploadedProjects/<user id>
    export LANG\=en_US.US-ASCII
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -target arm64-apple-ios8.0 -fmessage-length\=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit\=0 -std\=gnu99 -fobjc-arc -fmodules -gmodules -fmodules-prune-interval\=86400 -fmodules-prune-after\=345600 -fbuild-session-file\=/var/folders/lj/wrbzzxds6b53f88_rx3x7c800000gn/C/org.llvm.clang/ModuleCache.noindex/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror\=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Werror\=return-type -Wno-implicit-atomic-properties -Werror\=deprecated-objc-isa-usage -Wno-objc-interface-ivars -Werror\=objc-root-class -Wno-arc-repeated-use-of-weak -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wno-non-literal-null-conversion -Wno-objc-literal-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wno-deprecated-implementations -DB4I_VERSION\=13 -DNS_BLOCK_ASSERTIONS\=1 -DOBJC_OLD_DISPATCH_PROTOTYPES\=1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.3.sdk -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -fvisibility\=hidden -Wno-sign-conversion -Wno-infinite-recursion -Wno-comma -Wno-block-capture-autoreleasing -Wno-strict-prototypes -Wno-semicolon-before-method-body -iquote /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/HttpServer-generated-files.hmap -I/Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/HttpServer-own-target-headers.hmap -I/Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/HttpServer-all-target-headers.hmap -iquote /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/HttpServer-project-headers.hmap -I/Users/administrator/Documents/UploadedProjects/<user id>/Payload/include -I/Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/DerivedSources-normal/arm64 -I/Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/DerivedSources/arm64 -I/Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/DerivedSources -F/Users/administrator/Documents/UploadedProjects/<user id>/Payload -F../../Libs -MMD -MT dependencies -MF /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/arm64/main.d --serialize-diagnostics /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/arm64/main.dia -c /Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/main.m -o /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/arm64/main.o


Error: ** BUILD FAILED **


The following build commands failed:
    CompileC /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/arm64/b4i_main.o /Users/administrator/Documents/UploadedProjects/<user id>/B4iProject/b4i_main.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

how can i fix it ??
After so many attempts the problem may be because I compiled into the secondary hosted constructor. Now I have also compiled on main. If you use the hosted builder you can give it a try.

If you use a local constructor, the problem may be in updating it to the latest version.

In a similar problem from another library these two methods solved the problem.
 

Waldemar Lima

Well-Known Member
Licensed User
After so many attempts the problem may be because I compiled into the secondary hosted constructor. Now I have also compiled on main. If you use the hosted builder you can give it a try.

If you use a local constructor, the problem may be in updating it to the latest version.

In a similar problem from another library these two methods solved the problem.
Awesome ! i'll try, thanks by support <3
 

watesoft

Active Member
Licensed User
Longtime User
I started developing a version of the HttpServer Library for iOs. It is still a beta version and not complete, but already functional. You can start using it to test it. Includes WebSocket and QueryElement implementation
Digest Auth will be added in the future. I have arrived at a first version of the server that allows Digest authentication.
NEW: I have arrived at a first version of the server that allows Digest authentication. It is not included in the distributed version
It is entirely written in B4i, it depends on the iNetwork library

The library has been updated to be cross-platform and you can find it in this THREAD


iHttpServer

Author:
Star-Dust
Version: 0.72
  • QueryElement
    • Events:
      • change (Resp As ServletResponse, Params As Map) ' QueryElement Event Click
      • click (Resp As ServletResponse, Params As Map) ' QueryElement Event Click
      • dblclick (Resp As ServletResponse, Params As Map) ' QueryElement Event Click
      • focus (Resp As ServletResponse, Params As Map) ' QueryElement Event Click
      • focusin (Resp As ServletResponse, Params As Map) ' QueryElement Event Click
      • focusout (Resp As ServletResponse, Params As Map) ' QueryElement Event Click
      • keyup (Resp As ServletResponse, Params As Map) ' QueryElement Event Click
      • mousedown (Resp As ServletResponse, Params As Map) ' QueryElement Event Click
      • mouseenter (Resp As ServletResponse, Params As Map) ' QueryElement Event Click
      • mouseleave (Resp As ServletResponse, Params As Map) ' QueryElement Event Click
      • mousemove (Resp As ServletResponse, Params As Map) ' QueryElement Event Click
      • mouseup (Resp As ServletResponse, Params As Map) ' QueryElement Event Click
    • Fields:
      • Event_change As NSString*
      • Event_click As NSString*
      • Event_dblclick As NSString*
      • Event_focus As NSString*
      • Event_focusin As NSString*
      • Event_focusout As NSString*
      • Event_keyup As NSString*
      • Event_mousedown As NSString*
      • Event_mouseenter As NSString*
      • Event_mouseleave As NSString*
      • Event_mousemove As NSString*
      • Event_mouseup As NSString*
      • NoEvent As B4IMap*()
    • Functions:
      • Class_Globals As NSString*
      • CreateEvent (ObjectName As NSString*, Event As NSString*, OtherEvent As B4IMap*()) As B4IMap*()
      • Eval (Script As NSString*, Params As B4IList*) As NSString*
      • EvalWithResult (Script As NSString*, Params As B4IList*) As NSString*
      • Initialize (ba As B4I*, Response As B4i_servletresponse*) As NSString*
        Initializes the object. You can add parameters to this method if needed.
      • IsInitialized As BOOL
        Verifica se l'oggetto sia stato inizializzato.
      • RunFunction (function As NSString*, ID As NSString*, Params As B4IList*) As NSString*
        Param = list or array: array as Object is wrong - array as Map is correct
      • RunFunctionWithResult (function As NSString*, ID As NSString*, Params As B4IList*) As NSString*
      • RunMethod (Method As NSString*, ID As NSString*, Params As B4IList*) As NSString*
        Param = list or array: array as Object is wrong - array as Map is correct
      • RunMethodWithResult (Method As NSString*, ID As NSString*, Params As B4IList*) As NSString*
        Param = list or array: array as Object is wrong - array as Map is correct
      • SelectElement (ID As NSString*) As NSString*
      • SetCommand (etype As NSString*, Method As NSString*, property As NSString*, ID As NSString*, Params As B4IList*, Arg As B4IList*) As NSString*
      • SetCSS (id As NSString*, Params As B4IList*) As NSString*
      • SetHtml (id As NSString*, Params As B4IList*) As NSString*

        Public Sub SetHeight (Value As String)
        End Sub
      • SetPropriety (Property As NSString*, Value As B4IList*) As NSString*
    • Properties:
      • AutomaticEvents
  • ServletRequest
    • Fields:
      • CharacterEncoding As NSString*
      • ConnectionAlive As BOOL
      • ContentLength As Long long
      • ContentType As NSString*
      • ID As NSString*
      • LogActive As BOOL
      • LogFirstRefuse As BOOL
      • MultipartFilename As B4IMap*
      • RequestCookies As B4IMap*
      • RequestHeader As B4IMap*
      • RequestParameter As B4IMap*
      • Timeout As Long long
    • Functions:
      • Class_Globals As NSString*
      • Close As NSString*
      • Connected As BOOL
      • GetHeader (Name As NSString*) As NSString*
      • GetHeadersName As NSObject*
        can be used to iterate over Header
        Example
        <code>
        For Each Name As String In ServletRequest.GetHeadersName
        Log("Value = " & ServletRequest.GetHeader(Name))
        Next</code>
      • GetInputStream As B4IInputStream*
      • GetMethod As NSString*
      • GetRequestHOST As NSString*
      • GetRequestURI As NSString*
      • GetWebSocketCompressDeflateAccept As BOOL
      • GetWebSocketCompressGzipAccept As BOOL
      • GetWebSocketMapData As B4IMap*
      • GetWebSocketStringData As NSString*
      • Initialize (ba As B4I*, CallBack As NSObject*, EventName As NSString*, Sck As B4ISocketWrapper*) As NSString*
        Initializes the object. You can add parameters to this method if needed.
      • IsInitialized As BOOL
        Verifica se l'oggetto sia stato inizializzato.
      • ParameterMap As B4IMap*
      • RemoteAddress As NSString*
      • RemotePort As Int
  • ServletResponse
    • Fields:
      • CharacterEncoding As NSString*
      • ContentLenght As Int
      • ContentType As NSString*
      • Status As Int
    • Functions:
      • Class_Globals As NSString*
      • Close As NSString*
      • Connected As BOOL
      • Initialize (ba As B4I*, Req As B4i_servletrequest*, ast As B4IAsyncStreams*, Sck As B4ISocketWrapper*) As NSString*
        Initializes the object. You can add parameters to this method if needed.
      • IsInitialized As BOOL
        Verifica se l'oggetto sia stato inizializzato.
      • ResetCookies As NSString*
      • SendFile (Dir As NSString*, fileName As NSString*) As NSString*
        don't use DirAssets
      • SendFile2 (Dir As NSString*, fileName As NSString*, Content_Type As NSString*) As NSString*
      • SendNotFound (filenameNotFound As NSString*) As NSString*
      • SendRaw (Data As Unsigned char()) As NSString*
      • SendRedirect (Address As NSString*) As NSString*
      • SendString (Text As NSString*) As NSString*
        sending text with Header
      • SendWebSocketBinary (Data As Unsigned char(), Masked As BOOL) As NSString*
      • SendWebSocketClose As NSString*
      • SendWebSocketPing As NSString*
      • SendWebSocketPong As NSString*
      • SendWebSocketString (Text As NSString*, Masked As BOOL, Compressed As NSString*) As NSString*
        Cmpressed as Deflate=zlib, gzip, none - (set always none)
      • SetCookies (Name As NSString*, Value As NSString*) As NSString*
        Set Cokies values on Browser
      • SetHeader (Name As NSString*, Value As NSString*) As NSString*
      • Write (Text As NSString*) As NSString*
        Sending text without header to dynamically send more text after the SendString
    • Properties:
      • OutputStream As B4IOutputStream* [read only]
      • Query As B4i_queryelement* [read only]
  • httpServer
    • Events:
      • Handle (req As ServletRequest, resp As ServletResponse)
      • HandleWebSocket (req As ServletRequest, resp As ServletResponse)
      • NewConection (req As ServletRequest)
      • SwitchToWebSocket (req As ServletRequest, resp As ServletResponse)
      • UploadedFile (req As ServletRequest, resp As ServletResponse)
      • UploadProgress (resp As ServletResponse, Progress As Float) ' Progress = 0-1
      • WebSocketClose (CloseCode As Int, CloseMessage As String)
    • Fields:
      • DigestAuthentication As BOOL
      • DigestPath As NSString*
      • htdigest As B4IList*
      • IgnoreNC As BOOL
      • realm As NSString*
      • Timeout As Int
    • Functions:
      • Class_Globals As NSString*
      • GetMyIP As NSString*
      • GetMyWifiIp As NSString*
      • Initialize (ba As B4I*, CallBack As NSObject*, EventName As NSString*) As NSString*
        Initializes the object. You can add parameters to this method if needed.
      • IsInitialized As BOOL
        Verifica se l'oggetto sia stato inizializzato.
      • Start (Port As Int)
        eg. Start(51051)
      • Stop As NSString*

Sample
View attachment 109438 View attachment 110139
Is it possible to provide a non-cross-platform version? The B4I version I used does not support cross-platform. thank you!
 

Star-Dust

Expert
Licensed User
When multiplatform is indicated it does not mean that the same library runs on 3 platforms, but that there is a version of the same library for each platform. Each version is single platform.

Go to the new thread and download the ios version.
 

watesoft

Active Member
Licensed User
Longtime User
When multiplatform is indicated it does not mean that the same library runs on 3 platforms, but that there is a version of the same library for each platform. Each version is single platform.

Go to the new thread and download the ios version.

When multiplatform is indicated it does not mean that the same library runs on 3 platforms, but that there is a version of the same library for each platform. Each version is single platform.

Go to the new thread and download the ios version.

Thank you for your reply, I called a third-party js file in my APP, which uses xhr to request some note files in MP3 format, and the http path must be used. So I plan to use a local httpsever(For example: http://127.0.0.1:51051, you can see it on lines 60-90 of the karaoke.html code file), which is already ok in the Android app (using httpserver written by Erel). I use your ihttpserver lib in ios but it doesn't work, I haven't written a web app before and know almost nothing about web programming, so would appreciate your help, thanks a lot.

There is an acoustic_grand_piano-mp3 folder in soundfont.zip, which is used to store musical notes MP3 files, because they are too large to upload, you can see it in the js (https://github.com/paulrosen/abcjs) file.

XHR JS snippet:
var xhr = new XMLHttpRequest();
    xhr.open('GET', url + instrument + '-mp3/' + name + '.mp3', true);
    xhr.responseType = 'arraybuffer';
    var self = this;
 

Attachments

  • Httpserver.zip
    7.7 KB · Views: 4

Star-Dust

Expert
Licensed User
the SoundFont.ZIP file inside is empty. I need to have it to test
 

Star-Dust

Expert
Licensed User
I got the mp3 files with the piano notes.
I copied the files to the Laragon server they don't work. You've probably forgotten some scripts
 

watesoft

Active Member
Licensed User
Longtime User
Sorry, is this the js file? Unzip abcjs-basic.zip,you can find it.
I put all the files on a network disk, I don't know if you can download it.http://watersoft.ysepan.com/?xzpd=1
In the html file, I changed the address of the soundfont to the local soundFontUrl:'http://127.0.0.1:51051', which is requested from the remote server by default.
Actually what I care about is how to start the http://127.0.0.1:51051 service in B4I, I don't know if the code I wrote in b4i is correct?
 

Attachments

  • abcjs-basic.zip
    220 KB · Views: 2
Last edited:

Star-Dust

Expert
Licensed User
abcjs-basic was there and in any case they could be downloaded on github.
The problem I think is in the web pages. As I told you I used a commercial http server (Laragon) and putting all the files does not work. The JS code does not load the various notes and therefore does not execute them.

I should study the JS code to understand what is missing, but as you surely understand, I don't have the time to do it.

If you have a working Android version, please attach it so I can see the differences.

Try running it with a commercial server. I think you should start with the ready-made examples on GitHub with port 80 on a commercial server. When everything works, you can transfer it to iHttpServer
 
Last edited:

watesoft

Active Member
Licensed User
Longtime User
abcjs-basic was there and in any case they could be downloaded on github.
The problem I think is in the web pages. As I told you I used a commercial http server (Laragon) and putting all the files does not work. The JS code does not load the various notes and therefore does not execute them.

I should study the JS code to understand what is missing, but as you surely understand, I don't have the time to do it.

If you have a working Android version, please attach it so I can see the differences.

Try running it with a commercial server. I think you should start with the ready-made examples on GitHub with port 80 on a commercial server. When everything works, you can transfer it to iHttpServer

Thanks a lot, I noticed that adding the code 'Svr.Start(51051)), there is an error(see b4i error log.jpg), removing the code the error disappears.

In addition, I uploaded a successful example of B4A, sondfont.zip is the same as the example of b4i.
 

Attachments

  • A-httpServer.zip
    381.4 KB · Views: 4
  • b4i error log.jpg
    b4i error log.jpg
    49.7 KB · Views: 7
  • b4a staff ok.jpg
    b4a staff ok.jpg
    22.3 KB · Views: 7
  • b4a ok log.jpg
    b4a ok log.jpg
    34.4 KB · Views: 7

Star-Dust

Expert
Licensed User
I found several things wrong with the code you use on iOs.

We assume that even on Android when I click PLAY it does not sound.
I saw in the pictures you posted that you recall the notes individually (eg A0, A1). I did the same and this is how it works (even if instead of playing the audio I download the MP3 file).


The same you get in iOs if you unzip the SoundFont file in the correct folder which is not Prog as you put in your B4I code

Finally the script to me does not even work on Android, so I repeat what I have been telling you for a few days, there is something wrong with the JS script.

The code you have in android is more complex, check the folders on which the request is made and set the type of content before responding to the browser, this is very important for the operation. But on iOs all this part is not there.

I think you need to go deeper into the subject and always try to work on a commercial Http Server such as laragon or similar and then if it works, transport it to B4X.


I can not give you any other help on this topic I have to follow my work and therefore I will not reply to your posts anymore. I wish you to solve.
 

watesoft

Active Member
Licensed User
Longtime User
I found several things wrong with the code you use on iOs.

We assume that even on Android when I click PLAY it does not sound.
I saw in the pictures you posted that you recall the notes individually (eg A0, A1). I did the same and this is how it works (even if instead of playing the audio I download the MP3 file).


The same you get in iOs if you unzip the SoundFont file in the correct folder which is not Prog as you put in your B4I code

Finally the script to me does not even work on Android, so I repeat what I have been telling you for a few days, there is something wrong with the JS script.

The code you have in android is more complex, check the folders on which the request is made and set the type of content before responding to the browser, this is very important for the operation. But on iOs all this part is not there.

I think you need to go deeper into the subject and always try to work on a commercial Http Server such as laragon or similar and then if it works, transport it to B4X.


I can not give you any other help on this topic I have to follow my work and therefore I will not reply to your posts anymore. I wish you to solve.

I'm very sorry to bring you so much trouble. In fact, this matter has troubled me for a long time. Android can really play sound well, and it has been used in my app for half a year. But it doesn't matter. I can use the remote soundfont temporarily,After finding the reason in the future, I will switch to the local server. Can you provide a successful example of the local httpsever? Let me check the cause of the error, Thank you very much for your help!
 
Top