Migrated from tutorial-sockets v5
This commit is contained in:
parent
2938610992
commit
f474ca356c
|
@ -5,7 +5,7 @@ Then you need to create and initialize a TSocket object<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.
|
||||
|
||||
<pre><nowiki>
|
||||
<pre>
|
||||
import sockets, strutils
|
||||
|
||||
when not defined(strutils.toStringSep):
|
||||
|
@ -68,4 +68,4 @@ while True:
|
|||
elif data.split()[3] == ":!totalmem":
|
||||
var msg = "Total memory: " & formatSize(int64(getTotalMem()))
|
||||
s.send("PRIVMSG " & data.split()[2] & " :" & msg & "\c\L")
|
||||
</nowiki></pre>
|
||||
</pre>
|
||||
|
|
Loading…
Reference in New Issue