B4J Tutorial [Server] Upload files from your B4A app to your B4J server over the internet

Discussion in 'B4J Tutorials' started by Erel, Jan 28, 2014.

Thread Status:
Not open for further replies.
  1. Erel

    Erel Administrator Staff Member Licensed User

    This example was created with a newer version of B4A which is not compatible with v2.3.
     
  2. TAK

    TAK Member Licensed User

    Hello, i try to save the massage in a file. But it doesnt work with "File.WriteString". How can i do it else?
     
  3. Erel

    Erel Administrator Staff Member Licensed User

    Which message? What doesn't work?
     
  4. TAK

    TAK Member Licensed User

    [​IMG]
    "Hello from B4A app!!!" for example.
    How can i write this string in a file?
    I tried it with "File.WriteString" but i didnt work.
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    Please start a new thread for this question in the Android subforum. Post your code and post the error message (or in which way it doesn't work).
     
  6. Luciano Boscolo

    Luciano Boscolo Member Licensed User

    Hello Erel,
    in the FileServer side there's this in Process_Globals:
    Code:
    Public filesFolder As String = "uploaded"
    What do I need to write if I want to change to a different folder like the following?

    Code:
    Public filesFolder As String = "c:\Remark_data\import"
    Thank you
     
  7. Luciano Boscolo

    Luciano Boscolo Member Licensed User

    Update: I found the solution on this way. ;)

    Code:
    Public filesFolder As String = "/c:/Remark_data/import"
    thanks
     
  8. Philip Prins

    Philip Prins Active Member Licensed User

    Hello Erel,

    I want to use the audio streaming (walkie talkie) to send to a B4J server that sends this audio stream to all other clients connected.
    Is this possible?

    Regards
    Philip
     
  9. Erel

    Erel Administrator Staff Member Licensed User

    Yes, it is possible. However it is not really related to this thread.
     
  10. TomDuncan

    TomDuncan Active Member Licensed User

    Can the client be written in b4J as well.
    My app will use a B4J server and the clients will be Android, IOS and B4J.

    Tom
     
  11. TomDuncan

    TomDuncan Active Member Licensed User

  12. TomDuncan

    TomDuncan Active Member Licensed User

    Has anyone got some demo code for Sending an image file from a client and saving it on the server?

    Tom
     
  13. Erel

    Erel Administrator Staff Member Licensed User

  14. luke2012

    luke2012 Well-Known Member Licensed User

    Hi @Erel,
    I understood the token system :) Only one question: this free service (DUCKDNS), in terms of reliability, is suitable only for dev & testing purpose or also for small env. production ?
     
    Last edited: Jul 3, 2015
  15. Erel

    Erel Administrator Staff Member Licensed User

    Sorry but I don't know. You will need to check it with them.

    There are several other non-free (but not expensive) services that you can also try.
     
  16. sasidhar

    sasidhar Active Member Licensed User


    Hi,

    When i run fileserver.jar at server where i have static IP. I am getting Java error. please let me know why this issue coming in command line.


    D:\New Folder\FileServer\Objects\Objects>java -jar fileserver.jar

    Error: A JNI error has occurred, please check your installation and try again
    Exception in thread "main" java.lang.NoClassDefFoundError: anywheresoftware/b4a/
    BA
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
    at java.lang.Class.privateGetMethodRecursive(Unknown Source)
    at java.lang.Class.getMethod0(Unknown Source)
    at java.lang.Class.getMethod(Unknown Source)
    at sun.launcher.LauncherHelper.validateMainClass(Unknown Source)
    at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
    Caused by: java.lang.ClassNotFoundException: anywheresoftware.b4a.BA
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 7 more

    thanks
    sasidhar
     
  17. Erel

    Erel Administrator Staff Member Licensed User

    Make sure that #MergeLibraries is set to True in the main module (or copy all the required libraries which are listed in the compilation window).
     
  18. sasidhar

    sasidhar Active Member Licensed User

    Thanks Erel..working well.. Very nice library. I am receiving both messages and Images to server.
    How can i send server to Mobile from same server application. Is it possible or need to use some other other libraries?
    Any examples similar.

    thanks
    sasidhar.M
     
  19. Erel

    Erel Administrator Staff Member Licensed User

    Please start a new thread for this question.
     
  20. haddad

    haddad Member Licensed User

    hi Erel

    i get this error
    2015-08-26 00:04:25.890:INFO::main: Logging initialized @527ms
    2015-08-26 00:04:26.010:INFO:eek:ejs.Server:main: jetty-9.1.z-SNAPSHOT
    2015-08-26 00:04:26.044:WARN:eek:ejh.MimeTypes:main: java.util.MissingResourceException: Can't find bundle for base name org/eclipse/jetty/http/encoding, locale fr_FR
    2015-08-26 00:04:26.059:INFO:eek:ejsh.ContextHandler:main: Started o.e.j.s.ServletContextHandler@64616ca2{/,file:/C:/Users/HADDAD/Desktop/FileServer/Objects/www,AVAILABLE}
    2015-08-26 00:04:26.064:INFO:eek:ejs.AbstractNCSARequestLog:main: Opened C:\Users\HADDAD\Desktop\FileServer\Objects\logs\b4j-2015_08_25.request.log
    2015-08-26 00:04:26.072:WARN:eek:ejuc.AbstractLifeCycle:main: FAILED ServerConnector@17550481{HTTP/1.1}{0.0.0.0:32482}: java.net.SocketException: Unrecognized Windows Sockets error: 87: socket
    java.net.SocketException: Unrecognized Windows Sockets error: 87: socket
    at sun.nio.ch.Net.socket0(Native Method)
    at sun.nio.ch.Net.serverSocket(Net.java:420)
    at sun.nio.ch.ServerSocketChannelImpl.<init>(ServerSocketChannelImpl.java:88)
    at sun.nio.ch.SelectorProviderImpl.openServerSocketChannel(SelectorProviderImpl.java:56)
    at java.nio.channels.ServerSocketChannel.open(ServerSocketChannel.java:108)
    at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:276)
    at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
    at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:218)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at org.eclipse.jetty.server.Server.doStart(Server.java:337)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at anywheresoftware.b4j.object.ServerWrapper.Start(ServerWrapper.java:151)
    at b4j.example.main._appstart(main.java:63)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:84)
    at b4j.example.main.main(main.java:29)
    2015-08-26 00:04:26.073:WARN:eek:ejuc.AbstractLifeCycle:main: FAILED org.eclipse.jetty.server.Server@735f7ae5: java.net.SocketException: Unrecognized Windows Sockets error: 87: socket
    java.net.SocketException: Unrecognized Windows Sockets error: 87: socket
    at sun.nio.ch.Net.socket0(Native Method)
    at sun.nio.ch.Net.serverSocket(Net.java:420)
    at sun.nio.ch.ServerSocketChannelImpl.<init>(ServerSocketChannelImpl.java:88)
    at sun.nio.ch.SelectorProviderImpl.openServerSocketChannel(SelectorProviderImpl.java:56)
    at java.nio.channels.ServerSocketChannel.open(ServerSocketChannel.java:108)
    at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:276)
    at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
    at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:218)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at org.eclipse.jetty.server.Server.doStart(Server.java:337)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at anywheresoftware.b4j.object.ServerWrapper.Start(ServerWrapper.java:151)
    at b4j.example.main._appstart(main.java:63)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:84)
    at b4j.example.main.main(main.java:29)
    main._appstart (java line: 63)
    java.net.SocketException: Unrecognized Windows Sockets error: 87: socket
    at sun.nio.ch.Net.socket0(Native Method)
    at sun.nio.ch.Net.serverSocket(Net.java:420)
    at sun.nio.ch.ServerSocketChannelImpl.<init>(ServerSocketChannelImpl.java:88)
    at sun.nio.ch.SelectorProviderImpl.openServerSocketChannel(SelectorProviderImpl.java:56)
    at java.nio.channels.ServerSocketChannel.open(ServerSocketChannel.java:108)
    at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:276)
    at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
    at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:218)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at org.eclipse.jetty.server.Server.doStart(Server.java:337)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at anywheresoftware.b4j.object.ServerWrapper.Start(ServerWrapper.java:151)
    at b4j.example.main._appstart(main.java:63)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:84)
    at b4j.example.main.main(main.java:29)
    main.main (java line: 29)
    java.lang.RuntimeException: java.net.SocketException: Unrecognized Windows Sockets error: 87: socket
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:114)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:84)
    at b4j.example.main.main(main.java:29)
    Caused by: java.net.SocketException: Unrecognized Windows Sockets error: 87: socket
    at sun.nio.ch.Net.socket0(Native Method)
    at sun.nio.ch.Net.serverSocket(Net.java:420)
    at sun.nio.ch.ServerSocketChannelImpl.<init>(ServerSocketChannelImpl.java:88)
    at sun.nio.ch.SelectorProviderImpl.openServerSocketChannel(SelectorProviderImpl.java:56)
    at java.nio.channels.ServerSocketChannel.open(ServerSocketChannel.java:108)
    at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:276)
    at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
    at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:218)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at org.eclipse.jetty.server.Server.doStart(Server.java:337)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at anywheresoftware.b4j.object.ServerWrapper.Start(ServerWrapper.java:151)
    at b4j.example.main._appstart(main.java:63)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
    ... 2 more

    why plz
     
Thread Status:
Not open for further replies.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice