ネットワークプログラミング特論
芝浦工業大学大学院
理工学研究科
電気電子情報工学専攻
なぜ「ネットワーク」「プログラミング」か
インターネットの価値
= E2E
END
に価値があるのではない
END
は,ユーザに対してオープンだから価値がある
オープン ≒ プログラマブル
この授業で得られるもの
インターネットの仕組みの中で何がどのようにプログラマブ
ルなのか分かる
自分でも使えるようになる
そうなっている理由が分かる
なかなか変えられないところが分かる
今後のインターネット (サービス) の方向性を予測できる
10000 things all ICS students should do before graduating
0000 : Buy your own domain name.ドメイン名を買う.
0001 : Install an Apache web server and configure it in a non-trivial way, e.g. to serve multiple domains.
Apacheをインストールし,複数ドメインなどの普通じゃない設定をしてみる. 0010 : Install WordPress and have your own blog. Write blog posts regularly. Write well. Good writing is a critical skill to master in this profession.
WordPressをインストールし blog を定期的に書く.文章力はとてもとても重要. 0011 : Run your own web site at home or in a hosting company.
自宅やホスティングを使って自分の Web サイトを立ち上げる.
0100 : Write at least one complete LAMP web app, preferably two : one where P=PHP, the other where P=Python.
LAMPを使って Web アプリを作る.できれば PHP と Python の両方で. 0101 : Have your own [physical or virtual] server on the cloud.
自分の物理的ないし仮想サーバーをクラウド上にもつ.
0110 : Install VMWare or equivalent in order to boot up your laptop with more than one OS.
VMware等を使ってノート PC を複数の OS でブート可にする.
0111 : Configure your home DSL router so that you serve a web site or other kind of server from your home machine / laptop to your friends.
10000 things all ICS students should do before graduating
1000 : Use a packet sniffer to learn about the network requests your computer does to your favorite game server.
自分のコンピュータとゲームサーバ間のパケットをダンプして解析する. 1001 : Make contributions to an open source project.
オープンソースプロジェクトに寄与する.
1010 : Write an app that uses at least one of the popular Web APIs, like Facebook Connect or one of Google’s.
Facebook Connectや Google などの Web API を使ってアプリを書いてみる. 1011 : Use Google AdSense on your web site, and make money just by virtue of attracting traffic.
Google AdSenseを自分の Web サイトに導入し,トラフィックでお金を稼いでみる. 1100 : Compile a complicated open source project from scratch, like OpenSim or Matterhorn.
OpenSimや Matterhorn などの複雑な OSS を 0 からコンパイルしてみる. 1101 : Read works of literature and, besides enjoying the ride, pay close attention to how the author tells the story and makes use of words. Your programs should be as carefully written as those works of art!
文献を利用するだけでなく注意深く読む.プログラムも同じくらい注意して書く. 1110 : Get yourself involved in a software project where requirements are bound to change halfway through : that’s about 0.01% of homework projects and about 99.99% of real world projects, so find one of the latter kind. Finish the project with patience and the ability to take criticism in a constructive way.
要求条件が途中で変わるようなソフトウェアプロジェクトに入ってみる.辛抱強く, 建設的に批判しながら,プロジェクトを完遂する.
1111 : Write an application using map-reduce. Run it on Google app-engine or amazon EC2.
授業の進め方
インターネット上のサービス提供の仕組みを沢山説明
基本的には広く
(
残念ながら
)
浅く
(howto
や
tips
は説明しない
)
なぜそうなってるか
?
技術的な理由
なぜそうなってるか
?
技術以外の理由
重要技術はソースコードで説明
成績
何か一つ作ってみる
(
最終課題
)
成績は,最終課題の発表,レポート,ソースコードで決める
授業中の質問・議論は成績として考慮する
いいわけ
授業の資料は,何年間も少しずつ更新しているものなので,一貫
性欠如,技術の抜け等多々あり (あとは自分で)
授業の予定
第
1
回 インターネットの基本
第
2
回
HTTP
第
3
回
HTML4
第
4
回 ブラウザプログラミング
(JavaScript, DOM, CSS)
第
5
回 ブラウザプログラミング
(JavaScript, Library)
第
6
回 セキュリティ
第
7
回 ブラウザプログラミング
(mashup)
第
8
回
XML
第
9
回
HTML5 (
狭義の
HTML5)
第
10
回
HTML5 (HTML5
外の新技術
)
第
11
回
REST
とマッシュアップ
第
12
回
Web
サーバーの基本
第
13
回 データベースとトランザクション
第
14
回 ビッグデータ処理
第
15
回 発表会
通して学ぶべき重要な概念 (とりあえず思いつく範囲で)
ソフトウェアアーキテクチャ
Client Server
3-tier
MVC
Layer
と Layer violation
ステートフルとステートレス
切断への耐性
キャッシュの方法
セッション → ステートフル
Compatibility & Connectivity
browser
間 compatibility
version
間 compatibility (forward, backward)
オプション機能の豊富さ (JS がオフとか)
Security
same origin
sanitize (XSS)
hash,
署名
共有鍵, 秘密鍵
歴史
ARPANET: 1960
年代
TCP/IP: 1970
年代
TCP/IP
の
(UNIX
への
)
普及
: 1980
年代
WWW
と
HTTP0.9: 1990
年頃
NCSA Mosaic: 1993
年
http://evolutionofweb.appspot.com/
にとても面白い年表がある
標準化
IETF
RFC (http://www.ietf.org/)
Internet Draft, Proposed Standard, Draft Standard, Internet
Standard
W3C (World Wide Web Consortium)
WHATWG
OASIS
defacto
本日のソースコード
C
で書いた
Socket
通信
client.c: C
版クライアント
server.c: C
版サーバー
pollserver.c: C
版サーバー (多重ソケット poll)
selserv.c, selcli.c,: C
サーバー (多重ソケット select)
Java
で書いた
Socket
通信
Client.java: Java
版クライアント
Server.java: Java
版サーバー
ネットワークの基本構成
ネットワークの基本構成
ルーター
ルーター
ルーター
PC PC PC PC PC PC PC PC PC PC PC PC PC PC PC PCサブネット(セグメントとも言う)
通信方式(サブネット内)
通信のデータ単位:パケット
宛先 MACアドレス (48bit) 送信元 MACアドレス (48bit) データ長 (16bit) データ (1500バイト) PCMAC: 100 MAC: 200PC MAC: 300PC MAC: 400PC