Slide 1Slide 2Slide 3Slide 4Slide 5Slide 6Slide 7Streams and Networking2-8-2012Opening DiscussionDo you have any questions about the quiz?Minute essay comments:You can stream text.Decorating.Saving DrawingsI want to start off by writing code to save our drawings.NetworkingThese days, a computer loses a lot of its value if it isn't networked.We need to learn how to allow our programs to talk to other computers.This can happen in a lot of different ways from just reading information off the machine to having a “dialog” to exchange information.Most things we want are in the java.net package.SocketsComputers communicate over sockets. They come in two main flavors.TCP – This is the default. Does handshaking to determine if messages get through. Reliable, but slower.UDP – Throw packets out and hope the other side gets them. Fast, but code has to deal with possible dropped packets.One machine acts as a server and waits on a port. Other machines, clients, can connect to that port.Sockets and StreamsSockets in Java communicate through streams. So any code you wrote for file streams can be converted to networking with little to no effort.Let's write a simple telnet based chat room first.After that we can add either chat or sending drawings to our main program.Minute EssayHow is your project going to be networked? Have you thought of any way that the code style we described here could be challenging to use?Next class is IcP #3. Try to add multithreading and/or networking to your
View Full Document