Sending strings between two computers via ethernet - Codetown2024-03-28T15:26:33Zhttps://codetown.com/forum/topics/sending-strings-between-two-computers-via-ethernet?commentId=2197786%3AComment%3A31300&feed=yes&xn_auth=noThanks, I will check those ou…tag:codetown.com,2011-10-05:2197786:Comment:313012011-10-05T14:20:58.999ZPaul Stearnshttps://codetown.com/profile/PaulStearns
<p>Thanks, I will check those out.</p>
<p> </p>
<p>Thanks again for the help.</p>
<p>Thanks, I will check those out.</p>
<p> </p>
<p>Thanks again for the help.</p> Hi Paul,
That's great news!…tag:codetown.com,2011-10-05:2197786:Comment:313002011-10-05T04:50:54.131ZBehr@nghttps://codetown.com/profile/BehrangSaeedzadeh
<p>Hi Paul,</p>
<p> </p>
<p>That's great news!</p>
<p> </p>
<p>I haven't used any of the products that you have mentioned in your post, but regarding scheduling commands to be executed at certain points in time, one option is to use <a href="http://download.oracle.com/javase/7/docs/api/index.html?javax/swing/Timer.html" target="_blank">java.util.Timer</a>. It has methods for scheduling code (tasks) to be executed at a given date, or at a given fixed rate (e.g. once every two hours).…</p>
<p>Hi Paul,</p>
<p> </p>
<p>That's great news!</p>
<p> </p>
<p>I haven't used any of the products that you have mentioned in your post, but regarding scheduling commands to be executed at certain points in time, one option is to use <a target="_blank" href="http://download.oracle.com/javase/7/docs/api/index.html?javax/swing/Timer.html">java.util.Timer</a>. It has methods for scheduling code (tasks) to be executed at a given date, or at a given fixed rate (e.g. once every two hours). <a target="_blank" href="http://www.exampledepot.com/egs/java.util/ScheduleRepeat.html">Here</a>'s an example.</p>
<p> </p>
<p>For a more sophisticated scheduling system, IMHO the most popular library in the Java world is the <a target="_blank" href="http://www.quartz-scheduler.org/">Quartz Scheduler</a>. Using Quartz you can express schedules using <a target="_blank" href="http://en.wikipedia.org/wiki/Cron">cron</a> expressions. <a target="_blank" href="http://www.quartz-scheduler.org/documentation/quartz-2.x/tutorials">Here</a>'s the tutorial for Quartz.</p> Behrang:
I wanted to let yo…tag:codetown.com,2011-10-05:2197786:Comment:312992011-10-05T02:20:03.814ZPaul Stearnshttps://codetown.com/profile/PaulStearns
<p>Behrang:</p>
<p> </p>
<p>I wanted to let you know that after a little trouble with the string being sent, I was successful in getting the DOS program to receive and execute command strings that I sent from my GUI. I had some issues finding the right method to use in sending the strings.</p>
<p> </p>
<p>I saw that you used println() in your example, but I noticed this automatically included a carriage return and line feed. The carriage return was fine, but the line feed caused an…</p>
<p>Behrang:</p>
<p> </p>
<p>I wanted to let you know that after a little trouble with the string being sent, I was successful in getting the DOS program to receive and execute command strings that I sent from my GUI. I had some issues finding the right method to use in sending the strings.</p>
<p> </p>
<p>I saw that you used println() in your example, but I noticed this automatically included a carriage return and line feed. The carriage return was fine, but the line feed caused an error.</p>
<p> </p>
<p>I tried using writeChars(), but this sent the ASCII characters as two bytes for Unicode. The DOS program saw the string, but was not written to handle the Unicode version of ASCII so it kicked back an error.</p>
<p> </p>
<p>After some research I found the writeBytes() method which sent the ASCII characters as one byte and success was had along with much rejoicing. Now that I had communication between my GUI and the DOS program, I have to make the GUI pretty. I have several sliders and check boxes to add for the necessary functionality.</p>
<p> </p>
<p>Eventually I want to add a timeline feature where I can set up several commands to execute at a specific time code. I would like it to look something like the time line that is used in Adobe After Effects, Premiere, or Audition. You would not know where I might look to tackle that problem would you?</p>
<p> </p>
<p>Thanks again for you assistance. When I get stuck again, and I will, I will post a new question.</p>
<p> </p>
<p> </p>
<p>Paul</p> Thanks for your support. I s…tag:codetown.com,2011-09-21:2197786:Comment:302562011-09-21T14:04:29.202ZPaul Stearnshttps://codetown.com/profile/PaulStearns
<p>Thanks for your support. I should be able to perform a test later this week with an actual system setup. I do not have all the pieces here with me, so a lot of this has been theory and work arounds.</p>
<p> </p>
<p>I will let you know if I have any success. Stay tuned.</p>
<p>Thanks for your support. I should be able to perform a test later this week with an actual system setup. I do not have all the pieces here with me, so a lot of this has been theory and work arounds.</p>
<p> </p>
<p>I will let you know if I have any success. Stay tuned.</p> Thanks for the elaboration. I…tag:codetown.com,2011-09-21:2197786:Comment:301272011-09-21T10:25:26.031ZBehr@nghttps://codetown.com/profile/BehrangSaeedzadeh
<div>Thanks for the elaboration. I think your logic makes sense. I haven't done something similar to this before, but as you've already mentioned, as long as you can make the ethernet controller and the ethernet-to-RS-233 converter work, you can use Java sockets* to communicate with the server. In case you've already encountered a problem setting up the ethernet controller let me know and I might be able to provide some help.</div>
<div><p> </p>
<p>* However it might be that you need to…</p>
</div>
<div>Thanks for the elaboration. I think your logic makes sense. I haven't done something similar to this before, but as you've already mentioned, as long as you can make the ethernet controller and the ethernet-to-RS-233 converter work, you can use Java sockets* to communicate with the server. In case you've already encountered a problem setting up the ethernet controller let me know and I might be able to provide some help.</div>
<div><p> </p>
<p>* However it might be that you need to communicate with the server over the UDP protocol rather than TCP. In that case your app would need to use DatagramSocket (example <a href="http://systembash.com/content/a-simple-java-udp-server-and-udp-client/" target="_blank">here</a>) to communicate with the server.</p>
</div> Behrang: 1- An MS-DOS system…tag:codetown.com,2011-09-20:2197786:Comment:302522011-09-20T17:38:18.641ZPaul Stearnshttps://codetown.com/profile/PaulStearns
<p>Behrang:<br></br> <br></br>1- An MS-DOS system that acts as a server and is <strong>not</strong> running Java (Java cannot be installed on MS-DOS).</p>
<p> </p>
<p>Yes, the MS-DOS computer is running a program called Hercules which provides automated control of a/v equipment used in planetariums like slide projectors, special effects, lights, video projectors and so on. The software was written several years ago in assembly language because that provided the performance required to control up to…</p>
<p>Behrang:<br/> <br/>1- An MS-DOS system that acts as a server and is <strong>not</strong> running Java (Java cannot be installed on MS-DOS).</p>
<p> </p>
<p>Yes, the MS-DOS computer is running a program called Hercules which provides automated control of a/v equipment used in planetariums like slide projectors, special effects, lights, video projectors and so on. The software was written several years ago in assembly language because that provided the performance required to control up to 256 devices at 100 cues per second. It was always intended to move the software to newer platform, but time and resources did not permit the necessary development. The system was designed to take external commands from other computer systems via the RS-232 port.</p>
<p>I want to try using an RS-232 to Ethernet converter to allow the DOS machine to be accessible via a network. I think it will work provided I can find a way to identify the Ethernet converter.</p>
<p> </p>
<p>2- A Java GUI client that runs on a machine that has Java installed that tries to communicate with the MS-DOS server through TCP/IP (ethernet)</p>
<p> </p>
<p>Yes, I want to build a GUI in Java that will live on another computer in the network. The GUI will allow the user access to the DOS program without having to actually work in the DOS world. This is only a temporary measure to provide a GUI to the existing version of the program. A newer version of Hercules is in the planning stages, but a new platform has not yet been decided upon.</p>
<p> </p>
<p>Since I cannot run a Java application on the DOS machine, I was hoping that I could connect to it if it was treated as the server. I know I cannot run a server application, but if I can identify it on the network and it is always looking for incoming comm traffic, I thought my GUI could act as a client to connect to it.</p>
<p> </p>
<p> </p>
<p>3- There's an app on the MS-DOS system that acts as a bridge between the ethernet and the RS-232 port</p>
<p> </p>
<p>I am hoping that the RS-232 to Ethernet converter will handle some of the connection issues. It appears as though I can send a string to the converter and it will handle translating the string into the RS-232 protocol. I should have the converter later this week and will be attempting to communicate through it.</p>
<p> </p>
<p>I know that Java will not run on the DOS computer, but was hoping there was a work around for it provided I could get access to it via the network. I hope this helps to clarify what I am trying to accomplish.</p>
<p> </p>
<p> </p>
<p>Paul</p>
<p> </p>
<p> </p> Hi Paul,
You're welcome!
…tag:codetown.com,2011-09-20:2197786:Comment:296422011-09-20T15:02:14.884ZBehr@nghttps://codetown.com/profile/BehrangSaeedzadeh
<p>Hi Paul,</p>
<p> </p>
<p>You're welcome! </p>
<p> </p>
<p>Now back to the problem, could you please elaborate a little bit more about the the setup of your system? Is it something like this:</p>
<p> </p>
<p>1- An MS-DOS system that acts as a server and is <strong>not</strong> running Java (Java cannot be installed on MS-DOS)</p>
<p>2- A Java GUI client that runs on a machine that has Java installed that tries to communicate with the MS-DOS server through TCP/IP (ethernet)</p>
<p>3- There's…</p>
<p>Hi Paul,</p>
<p> </p>
<p>You're welcome! </p>
<p> </p>
<p>Now back to the problem, could you please elaborate a little bit more about the the setup of your system? Is it something like this:</p>
<p> </p>
<p>1- An MS-DOS system that acts as a server and is <strong>not</strong> running Java (Java cannot be installed on MS-DOS)</p>
<p>2- A Java GUI client that runs on a machine that has Java installed that tries to communicate with the MS-DOS server through TCP/IP (ethernet)</p>
<p>3- There's an app on the MS-DOS system that acts as a bridge between the ethernet and the RS-232 port</p>
<p> </p>
<p>Or is it that you want to run Java on the MS-DOS machine as well? I think this won't be possible as Java is not available for MS-DOS.</p>
<p> </p>
<p>Cheers,</p>
<p>Behrang</p> Behrang:
Using the code you…tag:codetown.com,2011-09-20:2197786:Comment:296392011-09-20T14:30:41.395ZPaul Stearnshttps://codetown.com/profile/PaulStearns
<p>Behrang:</p>
<p> </p>
<p>Using the code you supplied and an example I found in one of my Java books I was able to open up connection between two laptops on my home network. I think I can adapt the code to create a simplified version of the GUI I am trying to create. Thanks so much for you assistance so far.</p>
<p> </p>
<p>However, I do have a question. Currently I am testing this on two laptops where I manually start the server code and then the client code. In my real GUI, I will have…</p>
<p>Behrang:</p>
<p> </p>
<p>Using the code you supplied and an example I found in one of my Java books I was able to open up connection between two laptops on my home network. I think I can adapt the code to create a simplified version of the GUI I am trying to create. Thanks so much for you assistance so far.</p>
<p> </p>
<p>However, I do have a question. Currently I am testing this on two laptops where I manually start the server code and then the client code. In my real GUI, I will have a laptop or some other computer try to connect to a computer that is running MS-DOS and using an RS-232 to Ethernet converter. In that case, I do not know how I can start a client application on the DOS machine.</p>
<p> </p>
<p>The DOS machine is setup so that the RS-232 connection is always listening for incoming commands, that is why I was originally thinking about starting my GUI project using only RS-232. I assume that will still be the case with the Ethernet converter. I would also assume that my GUI would have to act as the client and ask to connect to the DOS computer. I just need to figure out how to identify the Ethernet converter on the network.</p>
<p> </p>
<p>Does my logic make sense? Have you ever attempted something like this before?</p>
<p> </p>
<p>Thanks.</p>
<p> </p>
<p>Paul</p> Thanks Behrang!
I will give…tag:codetown.com,2011-09-19:2197786:Comment:303282011-09-19T18:15:18.119ZPaul Stearnshttps://codetown.com/profile/PaulStearns
<p>Thanks Behrang!</p>
<p> </p>
<p>I will give these a try. I understand about the busy weeks. That is kind why it is taking me so long to understand this. I do not write code for a living and am trying to learn Java as my schedule permits, which is not all that often.</p>
<p> </p>
<p>Thanks again.</p>
<p> </p>
<p> </p>
<p>Paul</p>
<p>Thanks Behrang!</p>
<p> </p>
<p>I will give these a try. I understand about the busy weeks. That is kind why it is taking me so long to understand this. I do not write code for a living and am trying to learn Java as my schedule permits, which is not all that often.</p>
<p> </p>
<p>Thanks again.</p>
<p> </p>
<p> </p>
<p>Paul</p> Hi Paul,
Sorry for the long…tag:codetown.com,2011-09-18:2197786:Comment:303252011-09-18T04:47:39.984ZBehr@nghttps://codetown.com/profile/BehrangSaeedzadeh
<p>Hi Paul,</p>
<p> </p>
<p>Sorry for the long delay. It was a couple of busy weeks for me. I have written a program and pasted the code here:</p>
<p> </p>
<p><a href="http://paste.ly/CXuN" target="_blank">http://paste.ly/CXuN</a></p>
<p><a href="http://paste.ly/CXuQ" target="_blank">http://paste.ly/CXuQ</a></p>
<p><a href="http://paste.ly/CXuR" target="_blank">http://paste.ly/CXuR</a></p>
<p><a href="http://paste.ly/CXuS" target="_blank">http://paste.ly/CXuS</a></p>
<p> </p>
<p>I have…</p>
<p>Hi Paul,</p>
<p> </p>
<p>Sorry for the long delay. It was a couple of busy weeks for me. I have written a program and pasted the code here:</p>
<p> </p>
<p><a href="http://paste.ly/CXuN" target="_blank">http://paste.ly/CXuN</a></p>
<p><a href="http://paste.ly/CXuQ" target="_blank">http://paste.ly/CXuQ</a></p>
<p><a href="http://paste.ly/CXuR" target="_blank">http://paste.ly/CXuR</a></p>
<p><a href="http://paste.ly/CXuS" target="_blank">http://paste.ly/CXuS</a></p>
<p> </p>
<p>I have commented it a bit, but if you had more questions don't hesitate to ask me. A simpler example that can only handle one client and hence does not have the complexity associated with thread management is also available here:</p>
<p> </p>
<p><a href="http://download.oracle.com/javase/tutorial/networking/sockets/" target="_blank">http://download.oracle.com/javase/tutorial/networking/sockets/</a></p>
<p> </p>
<p>Also the code I have uploaded is not complete enough: the only way to stop the threads is to quit the program.</p>