Migrated from tutorial-sockets v4

This commit is contained in:
Araq 2010-09-14 03:11:07 -07:00
parent 4cc3d25850
commit 2938610992
1 changed files with 2 additions and 3 deletions

View File

@ -1,11 +1,10 @@
The first thing you need to do is import the sockets module<br>
<code>import sockets</code><br>
Then you need to create and initialize a TSocket object<br>
<code><nowiki>var s: TSocket = socket()</nowiki></code><br>
<code>var s: TSocket = socket()</code><br>
After that you can use <code>s.connect("addr", TPort(80))</code> to connect to a server<br>
Once you connect to a server, you can send and receive messages to/from the server by using <code>s.send("Message")</code> to send, and <code>s.recv()</code> to receive.
== Examples ==
=== IRC Bot ===
<pre><nowiki>
import sockets, strutils