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

Thread: Something for starting with TcpUdp module

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

    Something for starting with TcpUdp module

    In a recent post with kryton9 I talked about possibility to use network to exchange data. Maybe to develop specific applications or maybe exchanging data in order to develop games with networking functionalities.

    In any way, just for starting, here it is a piece of code that shows how to exchange data between two computers over the network.
    It uses UDP protocol, more easy to be used and no need to be connected all the time to work.
    This example just implement a simple chatting console able to send and receive chatting data.

    How to use:
    • execute it on two different computers
    • tell each other the respective IP address
    • use F1 key to send data


    It can be implemented a lot with many functionalities and using UI module to give more professional look but here we are to understand the networking side of the project and possibly implement TCPUDP module with new native functionalities.

    Eros

    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
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10

    Re: Something for starting with TcpUdp module

    Forgot to say that if you have installed some firewall on your boxes, you have to authorize ports used by this example otherwise net packets will be discarded or blocked.

    This example works over any pct/ip network.

    In case of different networks (like 2 PC connected over internet) if routers or HW firewalls are used, some NAT (Network Address Translation) rules must be in place inside routers in order to let public IPs been exchanged with local lan IPs.

    In case internet connection is using modems the only thing to warry about is personal firewalls installed on PC.

    Regards
    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

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

    Re: Something for starting with TcpUdp module

    Oh wow, can't wait to test later tonight. I have a network at home so I can test it. More later, thanks in advance!!
    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

  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: Something for starting with TcpUdp module

    Eros, I tested the program. But couldn't see messages being sent between the 2 networked computers.
    I enabled a port for each on my linksys router and they each have assigned ip's.

    192.168.1.46:6112 the other is 192.168.1.34:5100 both ports granted UDP permission and no other firewalls used.

    I also tried both on the same port number and that didn't work either?

    This is all on my side of the network, not going out over the internet, but through my router/switch at home, if that helps.

    Let me know of anything else to try, it will be neat to get this going
    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: Something for starting with TcpUdp module

    Hi kryton9,

    I've tested the script on different situations and all was ok. I've tested at work where we have many nets and at home were I have a DSL router + switch and just one network (192.168.0.0/255.255.255.0) and all went fine. If you are on the same net like you (192.168.1.x) there should be no need to configure your router because in reality you are using your router as a switch (so usually no filters takes place). Different would be if you have some local vLan.
    In my tests all PC have Zone Alarm Pro installed but instructed to let local LAN pc to get through.

    In any case, to test, you just need to leave the same port on both PC (more easy for starting) and specify the other side IP.
    So, you have to tell to PC A which is the IP of PC B and to PC B which is the IP of PC A.

    If it is not working, more likely it is some software blocking on one of the two PC.
    If you have some security suite, this can be the problem. Many all in one security suites like Norton Internet Security or similar are in reality little personal firewalls.
    Also WinXP SP2 has firewall but usually it lets UDP to pass.

    I can try to add some auto-discover functionality to script broadcasting some messages and waiting for responses but in any case if you are protected on the used UDP port this will not solve the problem.

    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
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    67
    Posts
    3,869
    Rep Power
    404

    Re: Something for starting with TcpUdp module

    Eros, no software firewall is running. I just use my linksys as my hardware firewall.

    I have fixed ip's assigned to my computers and am able to send files back and forth.

    Here is my scenario:
    Main Computer 192.168.1.46 port 6112

    Notebook 192.168.1.34 I tried port 6112 and also own port of 5100.

    I ran your script on both computers.

    It gives the correct information for the computer I am on and also for the other computer on each one.

    Maybe I should not use any port and let it use the default, will test that before going to bed, as it just occured for me to try that
    .... will write in a minute ...

    Ok just using the default ports, which I didn't try before, is working one way. That is I started my Main computer first and then my notebook and I can send from Main to the notebook, but not from the notebook back to the Main computer.

    It is cool, will play with it more when I get back up, very sleep now
    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

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

    Re: Something for starting with TcpUdp module

    Tried it one more time, it is working now. I am just using the default ports and it works
    Before I didn't use the default ports, but assigned my own.
    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

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

    Re: Something for starting with TcpUdp module

    Good.

    Important is to make little steps to understand possible problems otherwise othe subtle reasons can be the cause of networking not working.
    On netwroking many aspects can be the cause of blocking problems.

    In the meantime, try to see souce code if all is clear. If you do not have time now, no problem. Important is that you was able to run it fine. I will take some time to try to better comment code, to add a more clever/clear user interface and to try to implement auto-discover PC already executing script over the LAN using broadcast messages.

    After all is clear, networking possibilitiers are infinite. We can create a personalized protocol or adhere to some ideas already developed by other. I this a little chat script can be a good example to create a gaming communication protocol.

    Anyhow, not high priority. Games must come first.

    Ciao and thanks a lot for your time spent using thinBasic and for your positive attitude, always.
    For us it is a precious present.

    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

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

    Re: Something for starting with TcpUdp module

    Eros, sorry I missed your reply here. I noticed lately that Show Unread Posts Since Last Visit is not working properly for me.
    The last few days I have been using the Home Button and then looking at the right side of the window for the latest messages.
    That is how I noticed this one tonight.
    I wonder if anyone else is noticing strange problems with that feature?

    thinBasic just amazes me each day. You guys really did an awesome job so far, when I look at all the commands and modules, it just boggles my mind!!! Thanks!!

    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

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

    Unread missing posts

    I noticed here and on gamedesignnovice.com that the Show unread posts since last visit are not showing all the posts not seen. This might have something to do with Simple Machine Forums. I have a hunch it must be maybe how many it can show on 1 page perhaps?

    It would be neat if both forums had the first page list all the new posts so it would be easy to see them and not miss anything. I noticed I am missing things or a few days late in replying many times because of this. Hope it is something easy for you guys to setup.
    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

Page 1 of 2 12 LastLast

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
  •