Announcement

Collapse
No announcement yet.

Sendind and recieving TCP messages between pc's on a LAN

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Sendind and recieving TCP messages between pc's on a LAN

    Hi,
    I'm trying to figure out how to send a mesage to specific users on a LAN. All users should be able to recieve and send amongs each other. I've looked at the Echo server and Client examples that comes with PBWin8xxx. I've read various articles on the net on how the TCP/IP is supposed to work. My rough plan for a solution is that the program will reside on each PC and run as a TCP server(listen to a specific port for messages). Suppose I know the IP address(dynamically allocated) of the PC I want to send the message to, how do I send/create a datagram that will end up at designated IP address. And is this doable? If I'm able to route TCP mesasges to a specific IP adress I want to add this funcionality to the Mr Sticky program downloaded from Powerbasic i.e being able post a Sticker on somebody elses screen.
    Any thoughts or hints will be appreciated.

    Regards
    Eigil

  • #2
    Any thoughts? ANY?

    Make sure you include an "opt out" feature.

    Popups when surfing the 'net are bad enough that I don't really need unsolicited "sticky notes" appearing on my screen.

    Or....you could enroll in a self-defense class to be prepared for the user reaction.
    Michael Mattias
    Tal Systems (retired)
    Port Washington WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      depends on how many users you want to do this with.
      you might want a program to act as a server and there be clients connecting to the server.
      you want low cpu usage from your computer on both the client and server
      if you do the server and client, you will much further along for future uses.

      i have never done this before
      i would consider runing a program designed around the echo server and client.
      have each users computer be a echo server.
      have a single computer be a central server for messages to go through.
      setup each users name in the central message server.
      when a message to a user needs to take place, have the central message server be a client on the echo server and send a tcp message to the users echo server, that would describe what program on the users computer to run or what action to take.
      the the echo server at the user's computer could start a program of your choice and that program would do something at the users computer, maybe to run a program to shutdown/reboot the computer, maybe to run a program to communicate with others on the lan with some sort of messaging software, maybe the program could read a todo list from somewhere, etc.

      you could do many things by having this kind of a setup, without having a bunch of different program running and listening on all kinds of ports.

      on the users side, you could have an ini file that has different parameters for the echo server to do.

      you can also put passwords into the message the client sends to the users echo server to validate.

      if you take the central server approach, you will not have to worry about having so many settings in a firewall as well.

      this will be a lot of work of having a central server, but the payoffs will be bigger in the long run.
      once again the central server will notify the user's computer by being a echo client and the user's computer will be a echo server to start things running.

      i did a server that i called a relay server and your central server will do something very similiar, but let this relay server really be your echo client to a users computer.


      paul
      Last edited by Paul Purvis; 7 Mar 2008, 10:26 AM.
      p purvis

      Comment


      • #4
        Eigil,

        One of my larger applications has a "private message' function built into it, that mimics the idea of email. There are many ways to do it, but after much consideration, I opted to have the program use a common folder (which is necessary for many other things in the networked world) and a common 'control file'. Basically, I created an 'address book', then when you send a message to someone, a record is created in a file that indicates who the message is for, the time/date sent, urgency flag, etc. The program has a simple timer that checks this file every second or so and when it sees there is a new message, it displays it (non by pop-up) so the user can review the contents if they wish. You can update the "displayed to user" and "Read by user" flag this way too.

        Generally speaking, I found that this method provides a lot more functionality over trying to control a direct transport send, and is much more reliable too. If the person getting the message isn't there or doesn't respond, how are you going to handle the sender? That's just one question you need to think about you way.
        Software makes Hardware Happen

        Comment


        • #5
          Thanks Joe and Paul for suggestions. As somebody seems to believe I don't have the intension to spam our LAN at work with electronic post-it notes. Instead of using Net Send via command prompt I want to make sure that the short message is clearly seen by the recipient. It would be a handy way to relay messages taken over the phone for example. There are software out there that actually enables you to do so.
          Joe, I think your route will be the easiest and fastest to go.
          I'll investigate further.

          Eigil
          Last edited by E Dingsor; 7 Mar 2008, 01:21 PM.

          Comment


          • #6
            Eigil,
            you may also have a look at...
            TCP Communication - TelegramTcp.bas

            [lMG]Image removed[/lMG]
            Last edited by Pierre Bellisle; 11 Mar 2008, 09:55 AM.

            Comment


            • #7
              Windows' Messenger?

              FWIW, I think anything which interrupts a working employee (short of, say, "FIRE!!") is counterproductive.
              Michael Mattias
              Tal Systems (retired)
              Port Washington WI USA
              [email protected]
              http://www.talsystems.com

              Comment


              • #8
                Pierre,
                That looks promising. Many thanks!

                Eigil

                Comment


                • #9
                  Originally posted by Michael Mattias View Post
                  Windows' Messenger?

                  FWIW, I think anything which interrupts a working employee (short of, say, "FIRE!!") is counterproductive.
                  It really depends on the purpose. For simply messaging, such as emailing between users, I'd agree. However, there are times, say when a server has to be taken off-line, that an "instant message" is far more productive. It tells people that something unusual is going to happen and they need to react to it NOW. I can't think of a lot of times this is necessary, and if this is its function, then I'd look at something already made for the purpose. However, it does have its place within a LAN environment.

                  BTW Michael....YOUR FIRED. Na, I'd prefer face to face
                  Software makes Hardware Happen

                  Comment


                  • #10
                    Pierre, how did you get that picture in that posting.


                    Joe is right about the message server, it is much better for central server to take the messages, then a program can poll the server on a specific time out and give the user a way of seeing a message.
                    an initial gui would be small then enlarged by the user if the message was not urgent where a larger screen could be displayed first.
                    by placing messages through a server and placing the messages in files, the user could read any messages sent while away and it should keep down the chit chat if the users knew it was being recorded also.
                    because computers break and people move around, it would be far more better to not use ip addresses alone.
                    paul
                    p purvis

                    Comment


                    • #11
                      Paul,
                      click on the [IMG] code is on link on the lower left part of this thread...

                      img Syntax look like this...
                      [lMG]http://MyIsp.com/MySpace/MyJpeg.JPG[/lMG]

                      You can also use animated gif...
                      [lMG]http://MyIsp.com/MySpace/MyAnimatedGif.GIF[/lMG]

                      ( Note that the images will be removed soon, I don't want to clutter my web space.)

                      [lMG]Image removed[/lMG]
                      Last edited by Pierre Bellisle; 11 Mar 2008, 09:54 AM.

                      Comment


                      • #12
                        Pierre
                        Thanks.

                        you will rarely here me use the word COOL. But that is COOL.
                        there have been times when it is so much easier to describe things, especially a gui, with a picture.

                        maybe PB will find a way of giving members a limited amount of space on their forum web server to hold a certain amount of jpeg files.
                        or they could place another secondary server at their site to host these other jpg files.

                        that way it could help us move faster along using PB with current and future operating systems and we all know we will be using something other or having to deal with another os other than the ones we are using now in the future, there is no way of getting around that one if you live much longer.

                        i would hate to see graphics of such as yours not be viewable in the future, and i am not suggesting to you not to remove it from your site, i am suggesting PB see if there is something they can do to preserve the jpg image on their web resources.

                        pdf files would be nice too, although i do not know how to make those fancy pages with pdf that use images, but that would be really nice where somebody has had hard time describing a concept or something and also pb could use it as a training tool for their products and update their training pdf documents as needed.

                        i am not in favor of images being in the cafe section, unless they have a shelf live.

                        when educating, one only has to look at the current books in store on programming to understand how well graphics makes it easier to learn sometimes.

                        i do not even know if making limitations at first would even be needed. some people on this forum are very experienced in graphic techniques and others are not, and some people need the ability to describe their communication much more in graphics that others.

                        it would add more volume on the bandwidth, but it might make things much better. Bandwidth, hard drive space, raid built in os, and computers have come down in price and will continue to take place.

                        Pierre, when i say COOL, i do not mean pretty, but well done and making it easier on me to understand your thoughts and what your program does.

                        i have done a little php programing. it did take a little learning php commands but before long i was able to allow a user to log in using passwords i had placed into a file at a secure location of the web server, and it let people upload files. all files where placed into a single place. it would not of been much effort to place those files in individual user directories and have a user display files in their own directory and make all directories viewable over the internet. i did not allow for viewing or deleting of files, because the files being transfered to web server where data files to be processed and deleted on the local lan side of the web server.


                        paul
                        Last edited by Paul Purvis; 8 Mar 2008, 05:31 PM.
                        p purvis

                        Comment


                        • #13
                          Originally posted by paul d purvis View Post
                          maybe PB will find a way of giving members a limited amount of space on their forum web server to hold a certain amount of jpeg files.
                          or they could place another secondary server at their site to host these other jpg files.
                          There are lot of free service that let one upload an image and then link to it from a forum, even with thumbnails, etc.
                          The first that come to my mind is, just as an example, ImageShack.us
                          Or you can get 100MB (I think) of space from Google Pages, etc. etc.

                          Bye!
                          -- The universe tends toward maximum irony. Don't push it.

                          File Extension Seeker - Metasearch engine for file extensions / file types
                          Online TrID file identifier | TrIDLib - Identify thousands of file formats

                          Comment


                          • #14
                            Actually a program "Winpopup" was a program that was a standard part of 95 and 98 that did exactly this. It got lost for NT so you had to use Net Send, unfortunately even Net Send doesn't work in Vista.
                            I have found the simplest method is to have a program on all comps that listens on a UDP port

                            Comment


                            • #15
                              RealPopup is a FREE program I've used on my network for years, and it does what you are mention you wish to accomplish. While it might not be all you want, it might give you some hints on how you might solve some issues and approach an interface.
                              Roger...

                              Comment


                              • #16
                                Roger.
                                If what i read correctly, that program uses the windows service "computer browser".

                                Microsoft as i understand it is getting away from computer browser because of security issues.

                                When i setup a computer, computer browser, microsoft automatic updates, messenger service, and indexing service is the first thing i disable, and i have just about everything else disabled as well if i can using services.msc.

                                just call me "Paranoid Purvis or Nervous Purvis"
                                Last edited by Paul Purvis; 11 Mar 2008, 04:41 PM.
                                p purvis

                                Comment


                                • #17
                                  Hello Paul,
                                  I don't know what it uses, but it works well across the network. As for services, all I know about the Computer Browser service is that it maintains a list of computers on the network (XP PRO, W2K PRO & Win98). I have the Computer Browser service running on this computer because it is a default state for the service and have had no problems that would make me turn it off. I've not checked on the W98 computer to see what it is doing, but it does use RealPopUp and seems to work just as well.

                                  If I were in your shoes, I would install it and catalog what it is doing and using and make my decision from there. If it is keeping track of where to send messages using th Browser Service, then you'll need to find an alternate way to handle that piece of the puzzle so that it keeps itself current for each node as computers become available and go off-line. Which still sounds like some kind of service, so I don't know if there is a net gain to rolling your own.

                                  Whatever you decide, it should be a fun project that will expand on what you know now, and it would be fun to hear about a different approach for easy text exchanges.
                                  Roger...

                                  Comment


                                  • #18
                                    well i am definitely interested in this thread.
                                    we do not use email for internal use, but the phone still works fine.
                                    It would be nice to have a internal solution that also makes use of the internet.

                                    i tried going back to find where i read about the computer browser service being remove in future versions of microsoft os, but i was not able to find it.
                                    Maybe it was the wins.

                                    i wanted to pass along the information if somebody was to write a program depending on the computer browser service and that feature became obsolete or even if somebody started using the service and soon found themselves backed up against the wall.

                                    i guess i got confused computer browser with wins


                                    With Windows 2000, Microsoft is moving away from NetBIOS names towards using the DNS for name resolution, so we need to get used to not being able to browse for networked resources.



                                    p purvis

                                    Comment


                                    • #19
                                      Hi guys,
                                      I've closer to a final solution, thanks to the Telegram example and code and other practical suggestions.
                                      The skeleton solution goes like this:
                                      1 When you start the program a record in a simple database is inserted or updated with Username and WS number
                                      2 A TCP server session is started locally and listens to a port(pulled from an INI file)
                                      3.For sending a Sticky note(instead of writing a message on a paper note and walk over to the recipients desk and stick it on the screen so it will be read!) to somebody elses PC you'll just right click and select the menu option Send to:
                                      4. If text on the note you'll be asked to enter a Username. That Username is looked up in the database. If username found, but no Ws number you'll get a message telling you that the user hasn't started the program and no transfer is made.
                                      If no username at all, you'll be notified with that too.
                                      5. The note(i.e text on the note) is sent to the the other computer with TCP notify etc
                                      6. When the recipients TCP server get the message the program creates a sticky note and pastes the incoming text on the note.
                                      7 When a user exits the program the ws number(local) stored in the database is deleted, but username is kept. Username for logging on the the LAN is constant, but the WS may not.

                                      The main program is mainly the Mr Sticky program with my TCP faclilty extension + some more.
                                      I'll post the whole code when I'm done.


                                      Eigil
                                      Last edited by E Dingsor; 13 Mar 2008, 02:18 PM.

                                      Comment


                                      • #20
                                        Eigil,

                                        One big thing to keep in mind. You're relying on the program to accurately log in and out. Its very possible that someone will have to reboot a computer, the power goes out, or any other number of scenarios where the program won't finish 'cleanly'. So you'll end up with people trying to send a message to a user who shows as being on, but is not. You're messaging system will have to be able to deal with that.

                                        Also, if I'm correct, the point is to minimize the paper-flow and necessity of people walking around, correct? If so, then why not incorporate some way to 'queue' the sticky note if the person isn't logged in? Even with the average telephone, if you don't answer, at least I can leave a message. It just seems to me that the usefulness of such a system is greatly diminished if it only works for people who are 'logged in'.

                                        I have to admit that while there are a number of pre-built applications that do this sort of thing, I wrote my own "private email" system in my latest application too. If nothing else, it was fun to do
                                        Software makes Hardware Happen

                                        Comment

                                        Working...
                                        X