From WikiChip
Difference between revisions of "mirc/commands/sockwrite"
< mirc‎ | commands

 
(29 intermediate revisions by 7 users not shown)
Line 1: Line 1:
The '''/sockwrite command''' allows you to send data to a TCP socket connection previously opened with [[/sockopen - commands|/sockopen]] (See [[TCP Sockets - mIRC|TCP sockets]]).
+
{{mirc title|/sockwrite Command}}
 +
The '''/sockwrite command''' allows you to send data to a TCP socket connection previously opened with [[/sockopen commands - mIRC|/sockopen]] (See [[TCP Sockets - mIRC|TCP sockets]]).
 +
You can specify a {{mirc|wildcard}} for the name to send the data to all matching sockets.
 +
 
 
When the data has been sent, the {{mIRC|on sockwrite}} event triggers.
 
When the data has been sent, the {{mIRC|on sockwrite}} event triggers.
  
'''Note''' if /sockwrite fails, on sockwrite triggers too and {{mirc|$sockerr}} is set as well as {{mirc|$sock}}().wserr and {{mirc|$sock}}().wsmsg.
+
mIRC will queue your request up to 16384 bytes, you must check how many bytes is the send buffer with {{mirc|$sock}}().sq before trying to queue on a socket
 +
 
 +
'''Note''': If the queue is empty, (first /sockwrite ever for example), you can send more than that limit and it will be sent as chunk of the send queue limit or less.
  
 
== Synopsis ==
 
== Synopsis ==
/sockwrite -bnt <name> [numbytes] <text|%var|&binvar>
+
/sockwrite -abnt <name> [numbytes] <text|%var|&binvar>
  
 
== Switches ==
 
== Switches ==
 
* '''-b''' - Indicates that you are specifying the numbytes value which is the number of bytes you want send, the full line is sent otherwise
 
* '''-b''' - Indicates that you are specifying the numbytes value which is the number of bytes you want send, the full line is sent otherwise
* '''-n''' - Appens a [[$crlf identifier - mIRC|$crlf]] to the line being sent if it's not a &binvar or if does not already end with a $crlf
+
* '''-n''' - Appens a {{mIRC|$crlf}} to the line being sent if it's not a &binvar and does not already end with a $crlf
 
* '''-t''' - Forces mIRC to send anything beginning with a & as plain text
 
* '''-t''' - Forces mIRC to send anything beginning with a & as plain text
 +
* '''-a''' - Prevents characters in the range 0-255 from being UTF-8 encoded as long as the line only contains characters in the range 0-255
  
 
== Parameters ==
 
== Parameters ==
* '''<name>''' - The sockname name.
+
* '''<name>''' - The socket name.
 
* '''[numbytes]''' - If -b has been specified, indicates the number of bytes you want to send.
 
* '''[numbytes]''' - If -b has been specified, indicates the number of bytes you want to send.
 
* '''<text|%var|&binvar>''' - The message you want to send, can be a binary variable.
 
* '''<text|%var|&binvar>''' - The message you want to send, can be a binary variable.
  
 +
'''Note''': if /sockwrite fails, {{mirc|$sockerr}} is set as well as {{mirc|$sock}}().wserr and {{mirc|$sock}}().wsmsg inside the {{mirc|on events/on sockwrite|on sockwrite}} event.
  
 
== Example ==
 
== Example ==
 +
 +
See the page for the {{mIRC|on events/on sockwrite|on sockwrite}} event for more informations and examples about /sockwrite
  
 
== Compatibility ==
 
== Compatibility ==
Added: mIRC v5.3
+
{{mIRC compatibility|5.3}}
 
 
Added On: 13/12/97
 
 
 
 
 
<small>Note: Individual switches were not taken into consideration.</small>
 
  
 
== See also ==
 
== See also ==
 
* [[List of commands - mIRC|List of commands]]
 
* [[List of commands - mIRC|List of commands]]
 
* [[List of identifiers - mIRC|List of identifiers]]
 
* [[List of identifiers - mIRC|List of identifiers]]
* [[/sockopen command - mIRC|/sockopen]]
+
* {{mIRC|/sockopen}}
 
+
* {{mIRC|/sockread}}
* [[on sockwrite - mIRC|on sockwrite]]
+
* {{mIRC|/sockmark}}
* [[$sockerr - identifiers - mIRC|$sockerr]]
+
* {{mIRC|on sockwrite}}
 +
* {{mIRC|on sockread}}
 +
* {{mIRC|$sockerr}}
 +
* {{mIRC|$sock|$sock()}}
  
 
{{mIRC command list}}
 
{{mIRC command list}}
  
[[Category:MIRC commands]]
+
[[Category:mIRC commands|sockwrite command - mIRC]]

Latest revision as of 20:05, 3 May 2023

The /sockwrite command allows you to send data to a TCP socket connection previously opened with /sockopen (See TCP sockets). You can specify a wildcard for the name to send the data to all matching sockets.

When the data has been sent, the on sockwrite event triggers.

mIRC will queue your request up to 16384 bytes, you must check how many bytes is the send buffer with $sock().sq before trying to queue on a socket

Note: If the queue is empty, (first /sockwrite ever for example), you can send more than that limit and it will be sent as chunk of the send queue limit or less.

Synopsis[edit]

/sockwrite -abnt <name> [numbytes] <text|%var|&binvar>

Switches[edit]

  • -b - Indicates that you are specifying the numbytes value which is the number of bytes you want send, the full line is sent otherwise
  • -n - Appens a $crlf to the line being sent if it's not a &binvar and does not already end with a $crlf
  • -t - Forces mIRC to send anything beginning with a & as plain text
  • -a - Prevents characters in the range 0-255 from being UTF-8 encoded as long as the line only contains characters in the range 0-255

Parameters[edit]

  • <name> - The socket name.
  • [numbytes] - If -b has been specified, indicates the number of bytes you want to send.
  • <text|%var|&binvar> - The message you want to send, can be a binary variable.

Note: if /sockwrite fails, $sockerr is set as well as $sock().wserr and $sock().wsmsg inside the on sockwrite event.

Example[edit]

See the page for the on sockwrite event for more informations and examples about /sockwrite

Compatibility[edit]

Added: mIRC v5.3
Added on: 13 Dec 1997
Note: Unless otherwise stated, this was the date of original functionality.
Further enhancements may have been made in later versions.


See also[edit]


v · d · e mIRC commands list

A /abook, /action, /add, /ajinvite, /alias, /aline, /ame, /amsg, /anick, /aop, /auser, /auto, /autojoin, /avoice, /away

B /background, /ban, /bcopy, /beep, /bindip, /bread, /break, /breplace, /bset, /btrunc, /bunset, /bwrite

C /channel, /clear, /clearall, /clearial, /cline, /clipboard, /close, /closechats, /closedccs, /closefserves, /closemsg, /cnick, /color, /colour, /comclose, /comlist, /commands, /comopen, /comreg, /continue, /copy, /creq, /ctcp, /ctcpreply, /ctcps

D /dcc, /dccserver, /dde, /ddeserver, /debug, /dec, /describe, /dialog, /did, /didtok, /disable, /disconnect, /dlevel, /dline, /dll, Template:mIRC/donotdisturb, /dns, /dqwindow, /drawcopy, /drawdot, /drawfill, /drawline, /drawpic, /drawrect, /drawreplace, /drawrot, /drawsave, /drawscroll, /drawsize /drawtext

E /ebeeps, /echo, /editbox, /else, /elseif, /emailaddr, /enable, /events, /exit

F /fclose, /filter, /findtext, /finger, /firewall, /flash, /flist, /flood, /flush, /flushini, /fnord, /font, /fopen, /fseek, /fsend, /fserve, /fullname, /fupdate, /fwrite

G /ghide, /gload, /gmove, /gopts, /goto, /gplay, /gpoint, /gqreq, /groups, /gshow, /gsize, /gstop, /gtalk, /gunload, /guser

H /hadd, /halt, /haltdef, /hdec, /hdel, /help, /hfree, /hinc, /hload, /hmake, /hotlink, /hop, /hsave

I /ial, /ialclear, /ialmark, /identd, /if, /ignore, /iline, /inc, /iuser

J /join

L /leave, /linesep, /links, /list, /load, /loadbuf, /localinfo, /log, /logview

M /maxdepth, /mdi, /me, /menubar, /mkdir, /mnick, /mode, /msg

N /noop, /notice, /notify

O /onotice, /omsg

P /pareline, /part, /partall, /pdcc, /perform, /play, /playctrl, /pop, /protect, /proxy, /pvoice

Q /qme, /qmsg, /query, /queryrn, /quit, /quote

R /raw, /registration, /reload, /remini, /remote, /remove, /rename, /renwin, /reseterror, /resetidle, /return, /returnex, /rlevel, /rline, /rmdir, /run, /ruser

S /save, /savebuf, /saveini, /say, /scid, /scon, /server, /set, /setlayer, /showmirc, /signal, /sline, /sockaccept, /sockclose, /socklist, /socklisten, /sockmark, /sockopen, /sockpause, /sockread, /sockrename, /sockudp, /sockwrite, /sound, /speak, /splay, /sreq, /strip, /switchbar

T /timer, /timestamp, /tip, /tips, /titlebar, /tnick, /tokenize, /toolbar, /topic /tray, /treebar

U /ulist, /unload, /unset, /unsetall, /updatenl, /url, /username, /uwho

V /var, /vcadd, /vcmd, /vcrem, /vol

W

X /xyzzy