— Scott McNealy, Sun Microsystems Chairman, President and ceo



Download 40,57 Mb.
Pdf ko'rish
bet440/555
Sana26.05.2022
Hajmi40,57 Mb.
#609235
1   ...   436   437   438   439   440   441   442   443   ...   555
Bog'liq
Head First Java (Kathy Sierra, Bert Bates) (z-lib.org)

PrintWriter writer = new PrintWriter(chatSocket.getOutputStream());
2
Make a PrintWriter chained to the Socket’s low-level 
(connection) output stream
PrintWriter acts as its own bridge between 
character data and the bytes it gets from the 
Socket’s low-level output stream. By chaining a 
PrintWriter to the Socket’s output stream, we 
can write Strings to the Socket connection.
Client
Socket’s output 
stream 
(we don’t need 
to know the actual class)
011010011
bytes to server
destination
chained to
The Socket gives us a low-level connection 
stream and we chain it to the PrintWriter by 
giving it to the PrintWriter constructor.
Chat server 
program
source
“message...”
PrintWriter
characters
Server
source


480
 
chapter 15
Before we start building the Chat app, 
let’s start with something a little smaller. 
The Advice Guy is a server program that 
offers up practical, inspirational tips 
to get you through those long days of 
coding.
We’re building a client for The Advice 
Guy program, which pulls a message 
from the server each time it connects.
What are you waiting for? Who knows 
what opportunities you’ve missed 
without this app.
The DailyAdviceClient
Treat yourself to 
a cold one! You 
deserve it!
Tell your boss 
the report will 
have to wait. There’s 
powder at Aspen!
That shade of 
green isn’t really 
workin’ for you...
The Advice Guy
Connect
1
Client connects to the server and gets an 
input stream from it
Client 
advice server 

Download 40,57 Mb.

Do'stlaringiz bilan baham:
1   ...   436   437   438   439   440   441   442   443   ...   555




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish