Maple Professional
Maple Academic
Maple Student Edition
Maple Personal Edition
Maple Player
Maple Player for iPad
MapleSim Professional
MapleSim Academic
Maple T.A. - Testing & Assessment
Maple T.A. MAA Placement Test Suite
Möbius - Online Courseware
Machine Design / Industrial Automation
Aerospace
Vehicle Engineering
Robotics
Power Industries
System Simulation and Analysis
Model development for HIL
Plant Modeling for Control Design
Robotics/Motion Control/Mechatronics
Other Application Areas
Mathematics Education
Engineering Education
High Schools & Two-Year Colleges
Testing & Assessment
Students
Financial Modeling
Operations Research
High Performance Computing
Physics
Live Webinars
Recorded Webinars
Upcoming Events
MaplePrimes
Maplesoft Blog
Maplesoft Membership
Maple Ambassador Program
MapleCloud
Technical Whitepapers
E-Mail Newsletters
Maple Books
Math Matters
Application Center
MapleSim Model Gallery
User Case Studies
Exploring Engineering Fundamentals
Teaching Concepts with Maple
Maplesoft Welcome Center
Teacher Resource Center
Student Help Center
Sockets[ReadLine] - ソケットからのテキスト行の読み込み
使い方
ReadLine(sid, timeout)
パラメータ
sid - 有効な開かれたソケット ID
timeout - (オプション) 非負の整数; タイムアウトの指定(単位秒)
説明
多くのネットワークプロトコルでは、より簡単で効果的な実行を行うために、行単位になっています。このため、ソケット接続上で一度に1行のテキストを読みこむため、ReadLine が用意されています。
手続き ReadLine は、手続き Sockets[Read] と似ています。しかし ReadLine は、データ内の最初の新しい行(ASCII 10) の文字に出会うと、読み込みを停止します。Sockets[Read] のように、手続き ReadLine はソケットからテキスト形式のデータを読み込むために使用されます。null バイトを含むデータを読み込むためには使用できません(バイナリデータの読み込みについては、Sockets[ReadBinary] を参照して下さい)。
引数 sid は、開かれたソケット接続に関する、ソケット ID でなくてはなりません。オプション引数 timeout は、ReadLine の呼び出しがタイムアウトでブロックされ、値 false を返すまでの秒数を示します。
ReadLine 手続きは、持続中断のプロトコルに従います(持続中断のプロトコルと Sockets パッケージ 参照)。
例
with( Sockets ): sid := Open( "localhost", "echo" );
Write( sid, "The higher, the fewer!\n" );
ReadLine( sid );
Close( sid );
sid := Open( "vulcan", "echo" );
Write( sid, "The higher,\nthe fewer!\n" );
sid := Open( "deneb", "finger" );
Write( sid, "maple\r\n" );
while line <> false do line := ReadLine( sid ): printf( "%s\n", line ) end do:
Login Name TTY Idle When Where maple Maple Development pts/7 <Apr 22 16:31> deneb.maplesoft. mapledis Maple Distribution < . . . . > false
参照
用語集 - socket, Sockets パッケージの紹介, Sockets[Peek], Sockets[Read], Sockets[ReadBinary], 持続中断のプロトコルと Sockets パッケージ
Download Help Document