This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi, i'm trying to understand this program. I got the drawing part and converting the brush strokes into packets. but i don't get the connection part. (Ultimately when i compile the program nothing comes out. it only displays: Usage: java Draw <my port> <remote host> <remote port>. could someone please verify what is wrong? Million thanks for the help.
As for the connection code i don't get is:
What does this do?
i see. thanks for trying it out for me.
i'm not quite sure but is this written in an internet form or a local form....
what if i want to change it such that it connects to a localhost instead...which part should i change?
You need to run two instances on different ports, e.g:
java Draw 30000 127.0.0.1 30001
and (another cmd prompt)
java Draw 30001 127.0.0.1 30000
Joined: Mar 19, 2012
Thank you for your help and patience! after posting the question i kinda figured it out and tried it however it did not work...i even created another Draw file and renamed it and tested it. but it still won't send....
could you do me another favor by testing it out please?
I do, can and will help, but you have to be honest here as to your capabilities.
Unless this is an interview for me ... ;)
Joined: Mar 19, 2012
sorry for not stating what i was trying to do at first. Little introduction on my situation:
I know java but i'm not that good in it. i've learned C++, VB, HTML,PHP within 1 year a few years ago in school. The school didn't really care about our knowledge as long as we managed to pass.
End of last year I started JAVA classes(as required by my school) Recently(within this year) I've been given JAVA assignments to do and managed to complete. All which were object oriented programming. All which i did through trial and error(and which was relatively easy), my grasp of JAVA(and other programming) is not good. If the code is easy(doesn't point here and there) i will understand. I've relied on Head-First JAVA book to pass so far.
This is an assignment for a subject called Operating Systems and Networking.
Part 2 of the assignment actually.
Part 1 required me to create a simple instant messenger which i managed to.
Part 2 requires me to select a more complex networking program. I have options, to code it myself(which has extra credit) or to take it from the net(which has less credit, which i intend to do) but to give reference to it. Then i will have to write a detailed report on step by step how does the program work. The reason i ended up doing something like this(whiteboard) was because i was given such a title. The title however, i find is too complex for me. Other titles were taken by my other classmates. I can't appeal to the school because its holiday now. The code was given to me by someone who found it online from some academic archive.
thanks for the help so far, really appreciate it and i hope you will be able to continue to help me.
You are able to run two instances (on different ports) but they cannot talk to each other.
The networking aspect is easy, send a UDP packet to some server, that server receives it.
UDP has none (if very minimal handshaking).
This example off the "net" seems to be more of a "Make this work" exercise"
From what you posted, I had to make a number of changes. Some are quite significant.
It works and looks quite nice when running though.
I do not think you have the expertise to make this work, maybe you will.
My question again is, what is the deliverable of the assignment? An essay?
Joined: Mar 19, 2012
Edit: i was not aware that Draw doesn't work until you told me.
There are 2 diff types of deliverable (verbally told by the teacher at least) the teacher is giving us leniency as she knows our programming is weak and we were not scheduled to take this subject until we completed a subject called Data structures or something....but the time table changed and we ended up taking the networking subject first.
Anyway back to the deliverable:
If the student wishes to write the code on his own. the code will be ran through a system to check for plagiarism online. If none is found the student is then interviewed by the teacher to ask him to explain the code. eg.like what does this part of the code do? how did you achieve this? if no folly is detected then the student gets marks and doesn't need to write a report.
Case 2(the lenient one)<<the one i'm choosing
If the student can't produce the code himself, he can get it from the internet or the library. However, by doing this the student forfeits a portion of marks and is required to write a report explaining in detail (to prove) that the student understands the code. Edit: the report is an essay.
I found other examples of these type of whiteboard programs but they are even more complex....some are even complete with login systems and broadcast to many users.
I asked the classmate who gave me the code. he gave me the link where he got it from. http://people.dsv.su.se/~vero-rar/java/Draw.java which i am shocked as i don't know what language is that...