Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Code: Networking

  1. #1
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10

    Code: Networking

    Hi all,

    I was quite busy recently but in reality I was working on the networking area.
    I'm finishing to implement few new functions in TcpUdp module and improving some already there.

    I'm also finishing a prototype script that will show a possible implementation of the networking side of the game.
    The script is composed of 2 parts: server and clients.
    A server application starts and wait for clients to connect.
    When a client starts, it sends a broadcast message on the LAN asking if a server is available.
    If a Server reply, they exchange few info for next data exchange.

    So far I've tested with 1 server and 10 clients.
    For the moment data exchanged is the window position and size of the clients. So every time the client window is moved or resized, those data is sent to the server that collect them and show in a ListView.

    Exchanged data can be whatever. For the moment I've just implemented few ideas.

    ADDED: 2008.10.19
    Attached to this post a demo of what I've so far. You will find a server application and a client application.
    • File attached contains a Server and a Client application
    • Server can be executed on any computer in your network, if you have a network. But if you have not a network it will be fine either. Important is to have a TcpIp stack installed but if you are reading this post it should be all ok
    • Client can be executed on the same computer of the server or in any other computer you can have on your local LAN
    • When Client and Server are executed nothing will happen.
    • Click on "I'm a Server" button in the server window. Server will start listening for clients to connect.
    • Click on "Find server" button on the Client side. If all ok, client will find the server and they will exchange few data for handshaking
    • If they seems connected, TRY TO MOVE client window around and see.
    • If you started more clients, move them around

    Forgot to say that if you have a personal firewall active, you will have to authorize those applications to work on the net.
    This is exact and normal because those applications try to act as server on UDP ports from 5000 to 5010. 5000 is Server, from 5001 to 5010 clients.

    Added: 2008.12.17
    • added full source code for client and server. thinBasic 1.7.0.0 needed!


    Ciao
    Eros
    Attached Images Attached Images
    Attached Files Attached Files
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  2. #2
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732

    Re: Code: Networking

    Nice surprise Eros,

    I am happy you are working on it.
    Networking was always "that complicated thing" for me, I hope new commands will change my mind


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  3. #3

    Re: Code: Networking

    NICE! THANK YOU!!!!

  4. #4
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    67
    Posts
    3,869
    Rep Power
    404

    Re: Code: Networking

    Thanks Eros, nice of you to tackle this one for us!
    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

  5. #5
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10

    Re: Code: Networking

    Attached to first post of this thread a demo of what I've so far. You will find a server application and a client application.
    • File attached contains a Server and a Client application
    • Server can be executed on any computer in your network, if you have a network. But if you have not a network it will be fine either. Important is to have a TcpIp stack installed but if you are reading this post it should be all ok
    • Client can be executed on the same computer of the server or in any other computer you can have on your local LAN
    • When Client and Server are executed nothing will happen.
    • Click on "I'm a Server" button in the server window. Server will start listening for clients to connect.
    • Click on "Find server" button on the Client side. If all ok, client will find the server and they will exchange few data for handshaking
    • If they seems connected, TRY TO MOVE client window around and see.
    • If you started more clients, move them around


    Programs are still under heavy change.
    Many things are still missing. I'm improving all the functionalities and deciding what to transfer from source code to compiled module functions.
    Very soon a final example with full thinBasic source code that will let you inspect it and suggest changes or whatever.

    Let me know.
    Ciao
    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  6. #6
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732

    Re: Code: Networking

    Hi Eros,

    very nice!
    Worked well, just had to confirm I really do not want to block the program from doing networking
    To launch multiple clients I had to launch them from different directories, could be related to de-bundling process.

    Thanks a lot!,
    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  7. #7
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10

    Re: Code: Networking

    Forgot to say that if you have a personal firewall active, you will have to authorize those applications to work on the net.
    This is exact and normal because those applications try to act as server on UDP ports from 5000 to 5010. 5000 is Server, from 5001 to 5010 clients.

    Yes, Petr. I confirm that to run multiple copies of the client requires to place them in different directories. This is the bundling process that fails when it try to "explode" bundled exe because in the same directory are already present expanded thinbasic and modules.

    Ciao
    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  8. #8
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    67
    Posts
    3,869
    Rep Power
    404

    Re: Code: Networking

    That worked really well on single machine acting as both server and client. Thanks again Eros!
    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

  9. #9

    Re: Code: Networking

    Yes, worked very well here too. Good job!

  10. #10
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10

    Re: Code: Networking

    Attached to first post of this thread please find full source code of Client/Server example previously release as executable.
    thinBasic 1.7.0.0 is needed in order to execute the examples.

    How to use them?
    • Run the Server script and click on "I'm a server" button
    • Run the Client script and click on "Find server" button
    • Move around client window and you will see Server window following your movements
    • Run more than one client script and move them around


    Client and Server scripts can be executed on different machines providing used UDP ports are not firewalled.

    Many things can be improved. Have fun with it.

    Ciao
    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

Page 1 of 2 12 LastLast

Similar Threads

  1. Networking human minds
    By LanceGary in forum Shout Box Area
    Replies: 1
    Last Post: 11-08-2010, 17:13

Members who have read this thread: 1

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •