Results 1 to 15 of 15

Thread: Another Winsock question

  1. #1

    Thread Starter
    Fanatic Member AccessShell's Avatar
    Join Date
    Oct 2013
    Posts
    790

    Question Another Winsock question

    I have seen several p2p chat programs in VB6. VB6 is good.

    The questions are:

    1. Why display the Local & Remote IP Address, or Local & Remote computer name? Why not just code it internally? Does the other side (person) need to know this information? Or is just for sample codes?

    2. Why request a port id? Why not just code it internally? Or is just for the sample codes?

  2. #2
    PowerPoster PlausiblyDamp's Avatar
    Join Date
    Dec 2016
    Location
    Pontypool, Wales
    Posts
    2,458

    Re: Another Winsock question

    Quote Originally Posted by AccessShell View Post
    I have seen several p2p chat programs in VB6. VB6 is good.

    The questions are:

    1. Why display the Local & Remote IP Address, or Local & Remote computer name? Why not just code it internally? Does the other side (person) need to know this information? Or is just for sample codes?

    2. Why request a port id? Why not just code it internally? Or is just for the sample codes?
    If somebody is going to connect to a server then they will need to know the name / ip address of the server - displaying the information makes it easier to find.

    An IP address might change, hard-coding a server address into a client would require the client to be recompiled if the ip address changed. Having a server name can prevent this as the name can be consistent even if the address changes.

    Requesting a port really depends on the scenario, if you are a well established app, with a well known default port then clients can safely assume (most of the time) that the default is the correct port. However if your sever is using a port number just picked at random then there is the possibility it might clash with other applications and need to be changed.

  3. #3

    Thread Starter
    Fanatic Member AccessShell's Avatar
    Join Date
    Oct 2013
    Posts
    790

    Re: Another Winsock question

    I think you are saying.

    When the host "Listens" on a port, the client has to know the port. Then I still can't change the port, because the does not yet the the new port number. I can't send it to him.

    The Computer name is not really useful if your are not on the same Lan. Then hos do I get the IP address to the client before connection - assuming an IP address change?

  4. #4
    PowerPoster PlausiblyDamp's Avatar
    Join Date
    Dec 2016
    Location
    Pontypool, Wales
    Posts
    2,458

    Re: Another Winsock question

    Exactly, when the server listens for incoming connections it will need to listen on a specific port. The client needs to connect on the same port for things to work.

    You could give the server a default port, just pick a pretty number and make that the default. Unless you deliberately choose to make the server listen on a different port, it will listen on this default. The client can then assume the default port will work.

    If the server port isn't the default then the client would need to know what to use.

    The issue of the server IP address really depends on where the server is running. If you are running it on your own pc (as an example) then clients would need to connect to whatever public IP address your ISP has assigned to you, this is probably the public address of your router. The router would then need to be configured to forward traffic to whatever pc is running the server.

    If the IP address of your router changes, entirely dependent on your ISP and how they assign addresses, then any clients would need to know the new address.

    You might find something like https://account.dyn.com/ could be useful, it would allow you to have a dns name for your public IP address - this way client's can connect by name instead of an address.

  5. #5

    Thread Starter
    Fanatic Member AccessShell's Avatar
    Join Date
    Oct 2013
    Posts
    790

    Re: Another Winsock question

    I am just cautious about making my IP address public. I really don't want the word to know that. That to me is the same as publishing a "telephone book" like they did before computers. In this case it would be called an IP Address book. We do not have sell phone books. We do not have e-mail address books.

    I guess I can pick an IP address and scan through port numbers until I get a hit.

  6. #6
    PowerPoster
    Join Date
    Nov 2017
    Posts
    3,116

    Re: Another Winsock question

    My honest opinion is that you should set aside any questions about anything related to making a chat program that is accessible from the outside world to you and start by just writing a chat program that works between two computers on your LAN. Get the server listening piece, the initial client connection and login process working, encryption, user management, get the chat management stuff working (enumerating users, moderation, etc.), and so on.

    In my opinion, you seem to be getting lost in terminology and misconceptions related to the nuances of getting software running on your home PC such that someone outside of your home network can connect to it. To be honest, that piece of it is essentially 0 lines of VB code, and all configuration of network gear (router/firewall).

    Good luck.

  7. #7

    Thread Starter
    Fanatic Member AccessShell's Avatar
    Join Date
    Oct 2013
    Posts
    790

    Re: Another Winsock question

    OptionBase1, I think you are right on 2 accounts.
    1. I should concentrate of writing the program(s) for my LAN first.
    2. I am getting lost in terminology and misconceptions confused. I don't know enough about them.

    Please confirm the following.
    When I write the program(s) as you suggest, if I use the "friendly name" of the client instead of the IP address. I will be closed to the rest of the world. That is, the in the client program I use the remote computer name. This is true even if some one else has the same friendly name?

  8. #8
    PowerPoster
    Join Date
    Nov 2017
    Posts
    3,116

    Re: Another Winsock question

    Quote Originally Posted by AccessShell View Post
    Please confirm the following.
    When I write the program(s) as you suggest, if I use the "friendly name" of the client instead of the IP address. I will be closed to the rest of the world. That is, the in the client program I use the remote computer name. This is true even if some one else has the same friendly name?
    Honestly, none of that makes any sense.

    Good luck.

  9. #9

    Thread Starter
    Fanatic Member AccessShell's Avatar
    Join Date
    Oct 2013
    Posts
    790

    Re: Another Winsock question

    Ok, so you know that I don't know anything about this. Why can't you be for informative and explain it better?

  10. #10
    PowerPoster
    Join Date
    Nov 2017
    Posts
    3,116

    Re: Another Winsock question

    There's no shortage of information on the internet on the fundamentals of network communications. I don't have the time or interest to do any sort of individualized tutoring.

  11. #11
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    5,120

    Re: Another Winsock question

    In the client you put a text box and a label with “Server address” caption. The “address” can be an IP address, a FQDN (like account.dyndns.org) or local workgroup computer name like MYSERVER. All of these will work the same, provided that your network stack/config is able to resolve everything to raw IP addresses which are reachable from your client machine (i.e. local LAN IPs or real internet IPs and you have connection to the internet).

    Edit: Btw, there a lot of sh*t chat apps on PSC unfortunately. You’ll need time and common sense to weed out the “POS code” there.

  12. #12

    Thread Starter
    Fanatic Member AccessShell's Avatar
    Join Date
    Oct 2013
    Posts
    790

    Re: Another Winsock question

    At OptionBase1's suggestion I have been trying to read about fundamental of networking.

    I found out that for now, I am on a HAN, not a LAN. HAN = Home Area Network. I think this makes a difference.
    I don't know how yet.
    I do know that for a HAN, I would have low traffic. I don't yet know if all the other devices on the network count as traffic (such as TVs, printer, etc).
    I learned the for a HAN, P2P may suffice, rather than Client/Server. However, when I open this up to people not in my HAN, I want to reduce the need for extensive re-coding.

  13. #13

    Thread Starter
    Fanatic Member AccessShell's Avatar
    Join Date
    Oct 2013
    Posts
    790

    Re: Another Winsock question

    More research,

    The IP Address I have located is my private IP Address. I think that means if I place it in a P2P or Client/server program, the world does not see it. Also, I can only use that number when communicating with other computers in my Home network.

    If this is true, what do I write to connect, or listen for someone else to connect from outside the home network? Also, this is the case where I need additional security - right?
    Last edited by AccessShell; Sep 4th, 2022 at 01:29 PM.

  14. #14

    Thread Starter
    Fanatic Member AccessShell's Avatar
    Join Date
    Oct 2013
    Posts
    790

    Re: Another Winsock question

    . . . .
    Last edited by AccessShell; Sep 6th, 2022 at 07:11 PM.

  15. #15
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    5,120

    Re: Another Winsock question

    Quote Originally Posted by AccessShell View Post
    More research,

    The IP Address I have located is my private IP Address. I think that means if I place it in a P2P or Client/server program, the world does not see it. Also, I can only use that number when communicating with other computers in my Home network.

    If this is true, what do I write to connect, or listen for someone else to connect from outside the home network? Also, this is the case where I need additional security - right?
    To connect as client you don’t do anything outside of normal TCP connections. It’s your network routing which will deliver packets back and forth to the server you are reaching to.

    For listening/serving content it’s more complicated. Some home routers support uPNP which allows forwarding ports from the edge device to local machine but in general you’ll need support of external server to expose your local service to the world (google ngrok) or to establish p2p connection (google STUN). Having a dedicated real IP is mandatory for anything more serious unlike test/dev local services which you can completely develop/test using LAN server/clients.

Posting Permissions

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



Click Here to Expand Forum to Full Width