Ips7 Link English
Ips7 Link English
Ips7 Link English
RFC 1006
for
PC SIMATIC S7
S7 200 1200 300 400 Siemens Logo
MS-Windows 2000/NT/XP/Vista/7, Linux
C/C++, c#, VB, VB.net,Delphi, Excel, Access, PHP and others
Sllnerstr. 9
D-92637 Weiden
www.traeger.de
[email protected]
Phone +49 961.482300
Page 1 of 41
Requirements:
operating systems
Linux
programming languages
Hardware
PLC
Delivery:
The following files can included:
main folder
Ips7lnk.pdf
german manual
ips7lnk-en.pdf
english manual
Version.htm
release information
folder win32
IPS7LNK.DLL
Driver DLL
IPS7LNK.LIB
Folder x64
IPS7LNK.DLL
Driver DLL
IPS7LNK.LIB
Folder CPP
IPS7LNK.H
IPS7LNK.DLL
Driver DLL
IPS7LNK.LIB
IPS7DEMO.DSP
IPS7DEMO.CPP
IPS7DEMO.EXE
Folder Delphi
IPS7LNK.PAS
IPS7LNK.DLL
Driver DLL
Page 2 of 41
Folder Delphi
IPS7DEMO.exe
IPS7DEMO.cfg
IPS7DEMO.dof
IPS7DEMO.dpr
IPS7DEMO.res
IPS7LNK.dcu
main.dcu
main.dfm
main.pas
OEM.BMP
Page 3 of 41
Folder VisualBasic
IPS7LNK.DLL
Driver DLL, Note: For Visual Basic and Excel, copy this file
to windows system folder!
IPS7LNK.BAS
IPS7DEMO.EXE
EXE-File of VB demo
IPS7DEMO.FRM
IPS7DEMO.FRX
IPS7DEMO.VBP
IPS7DEMO.VBW
Folder Excel
IPS7LNK.DLL
Driver DLL, Note: For Visual Basic and Excel copy these files
to windows system folder!
IPS7LNK.BAS
IPS7DEMO.XLS
Folder PHP
ips7lnk_php.so
Module of the PHP extension, copy ths file to the extension folder
of your PHP installation
Folder DotNet
DemoCSharp
DemoVB.net
NetFiles
ips7lnk.chm
Installation:
Windows: Copy the DLL to the program folder of your application or to the Windows
system directory.
Linux: link the .o-file to your application:
For .net see the documentation in ips7lnk.chm-file. For .net (C# and VB.net) all functiones are
embedded in a class. There exist assemblies for frameworks 2.0/3.0/3.5. These assemblies are
using the ips7lnk.dll. Take care to copy ips7lnk.dll to your program folder or to the Windows
system folder. Put the corresponding assembly ips7lnknet.dll as reference to your application.
So all functions are available. Copy als this file to your program folder or to the Windows
system folder
Page 4 of 41
PHP:
Copy the extionsion ips7lnk_php.so to the extension folder of your PHP installation
Take care that the extension is loaded. Do in PHP.ini or in your program by loading
dynamically.
for php.ini: extension = ips7lnk_php.so
in your program: ld (ips7lnk_php.so);
How it works:
IP-S7-LINK is a DLL for MS-Windows (95/98/2000/NT/XP/Vista/7)or a library or an extionsion
or .o-file for Linux (C,C++,PHP). With IP-S7-LINK you can connect your PC with industrial
ethernet of Siemens SIMATIC S7 systems from. Easy to use- functions make it very easy to
communicate with the PLC witht C, C++, Delphi, Visual Basic, Excel or PHP. For connection to
the PLC you need onldy the ip address , number of rack and slot of the PLC. So you can read
and write Flags, In, Out, Timer, Counter and data blocks of the PLC.
Page 5 of 41
Description in detail:
Please note: The functions are using the standard socket interface, with the result that the
function returns only after performing the task to the caller. For asynchronous operation, call
these functions easily from a separate thread on which to communicate to the system.
The following functions are available:
Functions for initialization:
Function
Function
Description / Purpose
(PHP)
IPS7Open
ips7_open
IPS7OpenPG
ips7_openpg
Version 1.17
to initialize the connection, there is only memory
prepared. The tcp/ip connections is to be started with the
first call to the read or write functions.
The connection is done over the PG-Channel of the
PLC.
IPS7OpenS7200
ips7_opens7200
Version 1.21
to initialize the connection, there is only memory
prepared. The tcp/ip connections is to be started with the
first call to the read or write functions.
The connection is done to a S7-200 PLC.
Calling parameters:
N
Data type
o.
Data
Name
Function
IPAdr
type
(PHP)
32-Bit
string
Pointer to
192.169.0.100
C-String
2
32-Bit
long
Rack
Value
0. Usually: 0
unsigned
3
32-Bit
Value
unsigned
Page 6 of 41
long
Slot
Data type
o.
Data
Name
Function
RxTimeout
type
(PHP)
32-Bit
long
Value
unsigned
5
32-Bit
long
TxTimeout
Value
unsigned
6
32-Bit
long
ConTimeout
Value
unsigned
Page 7 of 41
Function
Function
Description / Purpose
(PHP)
IPS7OpenEx
ips7_openex
Version 1.23
to initialize the connection, there is only memory prepared.
The tcp/ip connections is to be started with the first call to
the read or write functions.
With parameter AccessMode you can select the
connection channel or the PLC type (S7
200/300/400) or you can make connection over a
S7-Subnet.
calling parameters:
N
Data type
o.
Data
Name
Function
IPAdr
type
(PHP)
32-Bit
string
Pointer to
192.169.0.100
C-String
2
32-Bit
long
Rack
Value
0. Usually: 0
unsigned
3
32-Bit
long
Slot
Value
unsigned
4
32-Bit
long
SubNetId
Value
unsigned
0001
So give 0x00350001 as parameter.
This paramter is only used for AccessMode 10 or 11. For
other AccessModes dont care.
32-Bit
long
DstMPIAdr
Value
unsigned
Page 8 of 41
Data type
o.
Data
Name
Function
AccessMode
Mode of access
type
(PHP)
32-Bit
long
Value
unsigned
32-Bit
long
RxTimeout
Value
unsigned
8
32-Bit
long
TxTimeout
Value
unsigned
9
32-Bit
long
ConTimeout
Value
the PLC.
unsigned
meaning
Return value ist the reference number for this connection.
This calue ist to be use to call the other functions with the
input parameter Ref.
-2 No resource available.
-10 AccessMode invalid (from 1.23)
Page 9 of 41
Function
Function
Description / Purpose
IPS7Connect ips7_connect
Calling parameters:
Nr Data type
Function
(PHP)
1
32-Bit
long
Ref
Value
unsigned
connection.
Return value:
IPS7Connect returns a signed 32-Bit Value. The meaning is:
Value
Description of error
1 connection established
<= 0 connetion was not established. For detail see the return value of the read/write-functions.
Page 10 of 41
Function
Function
Description / Purpose
IPS7GetConnectStatus
ips7_getconnectstatus
Calling parameters:
Nr Data type
Function
(PHP)
1
32-Bit
long
Ref
Value
unsigned
connection.
Return value:
IPS7Connect returns signed 32-bit value. The meaning is:
Value
Description
1 connection established.
<= 0 connection disconnected.Call read/write functions again or all call IPS7Connect to connect.
Page 11 of 41
Function
Function
IPS7SetKeepAlive ips7_setkeepalive
Description / Purpose
Since V 1.35!
To set individual TCP/IP KeepAlive times. Use only if xou
want to change the default TCP/IP settings. Call this
function immediately after calling "Open"-function.
Calling parameters:
Nr Data type
Function
(PHP)
1
32-Bit
long
Ref
Value
unsigned
connection.
32-Bit
long
AliveTime
If there is no traffic in "AliveTime" (ms) for the TCP/IPconnection so a KeepAlive-packet ist sent to check the
connection. If an error happens the IP-Stack retries the in
"AliveInterval" (ms) the next KeepAlive-packet. This is
repeated several times within"AliveInterval". (Windows 6
times). If not successfully the connection is closed.
long
AliveInterval
Value
unsigned
32-Bit
Value
unsigned
Return value:
IPS7SetKeepAlive returns a signed 32-Bit Value. The meaning is:
Value
Description
0 setting the value was successfully.
Page 12 of 41
Function
Function
Description / Purpose
IPS7Close
ips7_close
Calling parameters:
Nr Data type
Function
(PHP)
1
32-Bit
long
Ref
Value
unsigned
connection.
Return value:
The Functions returns a signed 32-Bit value. The meaning is:
Value Description of error
0 everything okay
-3 With the reference number
meaning / action
Connection closed, allocated memory released
Call any Open function!
------------------------
Page 13 of 41
Function
Description / Purpose
(PHP)
IPS7RdW
ips7_rdw
IPS7RdPlcW
ips7_rdplcw
IPS7RdB
ips7_rdb
IPS7WrW
ips7_wrw
IPS7WrPlcW
ips7_wrplcw
IPS7WrB
ips7_wrb
IPS7RdDW
ips7_rddw
IPS7WrDW
ips7_wrdw
IPS7RdReal
ips7_rdreal
IPS7WrReal
ips7_wrreal
Before reading/writing word by word to the PLC check if you want to use the
starting address like PLC-programming-syntax or if you want to use the arithmetical
correct starting address. You have to select the right function IPS7RdPlcW/IPS7WrPlcW or
IPS7WrW/IPWrPlcW For details see New in Version 1.17!
Explanation for PHP
In PHP variables are in principle not assigned to a spezific data type. The determination of the
data type processes the extension module.
Basically:: The destiantion variable respectively source variable representing the read/write
bufferr (=parameter no. 6) have to be passed by refernce. You have to use the &
character.
z.B. $Res = ips7_rdplcw ($Ref, ord (M), 0, 0, 2, &$Value);
Value[0] is MW0 (Flag word)
Value[1] is MW2 (Flag word)
In PHP there do not exist 16-bit-values, instead all 16-bit-data from PLC are saved als long in
PHP.
The word-functions will save the result to an array of long. If you read only one single item, so
the result is saved to one single long (If the varable passed isnt yet an array. Reading and
writting of words (16-bit) is basically processed as a signed value. That is the value is
interpreted as a 16-bit integer. If the value should be processed as unsigned 16-bit integer, so
Page 14 of 41
Data type
Data type
Name
Function
Ref
(PHP)
1
32-Bit
long
Value
unsigned
connection.
32-Bit
long
Typ
Value
In, Out,Flags...):
unsigned
32-Bit
32-Bit
DBNr
Value
Value
unsigned
unsigned
32-Bit
32-Bit
Value
Value
unsigned
unsigned
use value 0
Ab
Nr
Data type
Data type
Name
Function
(PHP)
5
32-Bit
32-Bit
Value
Value
unsigned
unsigned
32-Bit
mixed
Pointer
Anz
Buffer
Page 16 of 41
Nr
Data type
Data type
Name
Function
long
bSigned
(optional)
with
ipss7_rdplcw
ipss7_rdplcw
ips7_rdw
ips7_rdw
ipss7_wrplcw
(PHP)
7
---------
ipss7_wrplcw
ips7_wrdw
ips7_wrdw
Optionally you can select the value is processed as signed
Page 17 of 41
Function (PHP)
Description / Purpose
IPS7RdBit
ips7_rdbit
IPS7SetBit
ips7_setbit
IPS7ResetBit
ips7_resetbit
Calling parameters:
Bit read/write functions have the same input parameters:
Nr
Data type
Function
(PHP)
1
32-Bit
long
Ref
Value
unsigned
connection.
32-Bit
long
Typ
Value
In, Out,Flags...):
unsigned
32-Bit
32-Bit
Value
Value
unsigned
unsigned
32-Bit
32-Bit
Value
Value
unsigned
unsigned
32-Bit
DBNr
Ab
long
Bit
mixed
Buffer
Value
unsigned
6
32-Bit
Adresse
Page 18 of 41
Funtion for oOptimized reading of various data areas with one single call (new since
V 1.35)
Function
Function
Description / Purpose
(PHP)
IPS7RdMulti
ips7_rdmulti
IPS7RdMultiC
alcPacketCnt
etcnt
IPS7RdMulti automatically performs a data transfer between PC and S7. The conversion is
comparable to the "Data type-casting" in the language. The bit width must be equal to or
greater than the data types in the PC than that in the PLC. The caller has to provide a
sufficiently large target area. Which means: If for example Two 16-bit value (total 32 bits) are
read and converted to double value (64 bit) in the PC. The size of the buffer in your PC
programm has to be minimum two double values (a total of 128 bits). The conversion looks
like in the example:
Value in PLC
Value in PC
6.0
1.0
The choice of PLC and PC data types is in the request job. Encoded using constants as
described in the following
Page 19 of 41
Typ
Description / Purpose
DataArea
32-Bit
unsigned
Out,Flags...):
D = 68 dec. Datablocks (DB)
E = 69, dec. In (Inputs)
A = 65 dec. Out (Outputs)
M = 77 dec. Flags (in german Merker)
T = 84 dec. Timer (access only as double word, 32 bit)
Timers of the PLC are saved with base of time and value in BCD format.
IP-S7-LINK automatically converts the format an 32 bit value in units of
milliseconds. The resolution is 10 ms. Writing time values, the drivers will
select the best time base in the PLC. Note: Depending of the size of the
value an the selected time base, there will be resolution errors. Allowed
values from 0 to 9990000 ms
Z = 90 dec. Counter (german Zhler), supported ony word functions
In the PLC counters are also saved in BCD format. Values for counter are
running frome 0 to 999. The driver converts automatically to and from
decimal fromat.
DataType
32-Bit
unsigned
DBNr
Cnt
Value
IPS7_BIT
IPS7_BYTE
Byte (8 Bit)
IPS7_WORD
IPS7_INT
IPS7_DWORD
IPS7_DINT
IPS7_REAL
S7Real
IPS7_TIMER
Timer in S7 PLC
IPS7_COUNTER
counterr in S7 PLC
32-Bit
Data block number, this is only used for type 'D '. Otherwise there is the
unsigned
value "0"
32-Bit
unsigned
Start
32-Bit
unsigned
StartBit
Page 20 of 41
32-Bit
The number of the first bit in the PLC, value (0 - 7), is used only for bit
unsigned
access, 0 otherwise
Name
Typ
Description / Purpose
PCDatyType
32-Bit
Data type im PC
unsigned
Result
Name
PC_BYTE
Byte (8 Bit)
PC_WORD16
PC_INT16
PC_WORD32
PC_INT32
PC_FLOAT
32 Bit float in PC
PC_DOUBLE
64-Bit double in PC
32-Bit
Result after processing the job. The individual value can be found under
unsigned
the description:
Return value for Read/Write functions or Result in record
IPS7RdMulti
UserData_0
32-Bit
Free for the user to saveing additional information like pointers or handles
unsigned
UserData_1
Data
32-Bit
unsigned
handles.
32-Bit
Pointer
pUserData
32-Bit
Pointer
handles.
Page 21 of 41
reaction / Action
process data
2 Block or data area does not exist, Verify that the desired data area exists in the PLC.
for example access to DB, which
is not available, or too small.
-1 Timeout, PLC not reachable
Page 22 of 41
reaction / Action
Check your source code whether the varable for the
performed Open..
-5 general error
-7 socket error
-8 memory error
-9 overrange
or is not supported.
-11 The specified PC data type do not e.g : This can occur if you want to access counter and the
correspond to thespecified PLC
data area
call close.
Page 23 of 41
Description / Purpose
Buffer
Count
count of values
assigned bytes
MW0
MB 0 and MB 1
MW1
MB 1 and MB 2
MW2
MB 2 and MB 3
You see, that there may be when using odd word addresses in double occupancy. Therefore,
the word functions (IPS7RdW and IPS7WrW) only support access to even word addresses.
This means that the start-word-no in the driver is always multiplied by 2. This method allows
for the simple image of the PLC memory to the PC. So a word step in the PC are 16 bits in
the PC and 16 bit in the PLC
Example:
WORD Buf[64];
Page 24 of 41
PLC
Buf[0]
DW 0
Buf[1]
DW 2
Buf[2]
DW 4
You have to devide the start word number by two to make right access in the PC. This is also
necessary for data blocks!! --> odd word addresses of PLC could not be read/write word by
word.
If you like to access to odd addresses use IPS7RdPlcW / IPS7WrW functions.
program samples:
a) Reading words read DB 10, start at DW0, 10 words:
Calling from C/C++:
unsigned short int WordBuffer[512];
IPS7RdW (Ref, D, 10, 0, 10, WordBuffer);
Calling from Delphi:
WordBuffer array [0..511] of Word;
IPS7RdW (Ref, LongWord (D), 10, 0, 10, @WordBuffer[0]);
Calling from Visual Basic:
Dim WordBuffer (0..511) as Word;
IPS7RdW (Ref, 68, 10, 0, 10, WordBuffer(0))
result after calling:
PC
PLC
WordBuffer[0]
DB10.DBW0
WordBuffer[1]
DB10.DBW2
WordBuffer[2]
DW10.DBW4
PLC
ByteBuffer[0]
MB 0
ByteBuffer[1]
MB 1
Function
Function
Description / Purpose
(PHP)
IPS7GetSockErr
ips7_getsockerr
get the last socket error. For Windows check the list in the
appendix. In Linux the numbers ar declarated in the
systemfile errno.h
Calling parameters:
Nr Data type
Function
(PHP)
1
32-Bit Value
long
Ref
unsigned
Return value:
The return value is a signed 32-bit value:
Value Description of error
0 everything okay
else
Meaning / Reaktion
no error
For Windows see the list in the appendix. For Linux see
system file errno.h.
Page 26 of 41
ips7_getplcname
IPS7GetModuleName
ips7_getmodulename
IPS7GetPlantIdName
ips7_getplantidname
IPS7GetCopyrightEntry
ips7_getcopyrightentry
IPS7GetModuleSNr
ips7_getmodulesnr
IPS7GetModuleTypeName
ips7_getmoduletypename
IPS7GetMMCSNr
ips7_getmmcsnr
IPS7GetLocationDesignation
ips7_getlocationdesignation
IPS7GetOEMId
ips7_getoemid
Calling parameters:
Nr Data type
Function
(PHP)
1
32 bit value
long
Ref
unsigned
32-Bit Zeiger
auf C-String
string
strInfo
There are the same as return values for the read / write functions!
Page 27 of 41
Description / purpose
(PHP)
IPS7GetPLCTime
ips7_getplctime
Calling parameters:
Nr Data type
Function
(PHP)
1
32 bit value
long
Ref
unsigned
Year
Month
Day
Hour
Min
Sec
Ms
value
2
There are the same as return values for the read / write functions!
Page 28 of 41
Function
Description / purpose
(PHP)
IPS7SetPLCTime
ips7_setplctime
Calling parameters:
Nr Data type
Function
(PHP)
1
32 bit value
long
Ref
32 bit value
long
Year
32 bit value
long
Month
32 bit value
long
Day
32 bit value
long
Hour
32 bit value
long
Min
32 bit value
long
Sec
32 bit value
long
Ms
There are the same as return values for the read / write functions!
Page 29 of 41
Return code/value
Description
WSA_INVALID_HANDLE
6
An
application
attempts
to
use
an
event
object,
but
the
specified
handle
is
not
valid.
Note
that
this
error
is
returned
by
the
operating
system,
so
the
error
number
may
change
in
future
releases
of
Windows.
WSA_NOT_ENOUGH_MEMORY
8
An
application
used
a
Windows
Sockets
function
that
directly
maps
to
a
Windows
function.
The
Windows
function
is
indicating
a
lack
of
required
memory
resources.
Note
that
this
error
is
returned
by
the
operating
system,
so
the
error
number
may
change
in
future
releases
of
Windows.
WSA_INVALID_PARAMETER
87
An
application
used
a
Windows
Sockets
function
which
directly
maps
to
a
Windows
function.
The
Windows
function
is
indicating
a
problem
with
one
or
more
parameters.
Note
that
this
error
is
returned
by
the
operating
system,
so
the
error
number
may
change
in
future
releases
of
Windows.
WSA_OPERATION_ABORTED
995
An
overlapped
operation
was
canceled
due
to
the
closure
of
the
socket,
or
the
execution
of
the
SIO_FLUSH
command
in
WSAIoctl.
Note
that
this
error
is
returned
by
the
operating
system,
so
the
error
number
may
change
in
future
releases
of
Windows.
WSA_IO_INCOMPLETE
996
The
application
has
tried
to
determine
the
status
of
an
overlapped
operation
which
is
not
yet
completed.
Applications
that
use
WSAGetOverlappedResult
(with
the
fWait
flag
set
to
FALSE)
in
a
polling
mode
to
determine
when
an
overlapped
operation
has
completed,
get
this
error
code
until
the
operation
is
complete.
Note
that
this
error
is
returned
by
the
operating
system,
so
the
error
number
may
change
in
future
releases
of
Windows.
WSA_IO_PENDING
997
The
application
has
initiated
an
overlapped
operation
that
cannot
be
completed
immediately.
A
completion
indication
will
be
given
later
when
the
operation
has
been
completed.
Note
that
this
error
is
returned
by
the
operating
system,
so
the
error
number
may
change
in
future
releases
of
Windows.
Page 30 of 41
Return code/value
Description
WSAEINTR
10004
A
blocking
operation
was
interrupted
by
a
call
to
WSACancelBlockingCall.
WSAEBADF
10009
The
file
handle
supplied
is
not
valid.
WSAEACCES
Permission denied.
10013
An
attempt
was
made
to
access
a
socket
in
a
way
forbidden
by
its
access
permissions.
An
example
is
using
a
broadcast
address
for
sendto
without
broadcast
permission
being
set
using
setsockopt(SO_BROADCAST).
Another
possible
reason
for
the
WSAEACCES
error
is
that
when
the
bind
function
is
called
(on
Windows
NT
4.0
with
SP4
and
later),
another
application,
service,
or
kernel
mode
driver
is
bound
to
the
same
address
with
exclusive
access.
Such
exclusive
access
is
a
new
feature
of
Windows
NT
4.0
with
SP4
and
later,
and
is
implemented
by
using
the
SO_EXCLUSIVEADDRUSE
option.
WSAEFAULT
Bad address.
10014
The
system
detected
an
invalid
pointer
address
in
attempting
to
use
a
pointer
argument
of
a
call.
This
error
occurs
if
an
application
passes
an
invalid
pointer
value,
or
if
the
length
of
the
buffer
is
too
small.
For
instance,
if
the
length
of
an
argument,
which
is
a
sockaddr
structure,
is
smaller
than
the
sizeof(sockaddr).
WSAEINVAL
Invalid argument.
10022
Some
invalid
argument
was
supplied
(for
example,
specifying
an
invalid
level
to
the
setsockopt
function).
In
some
instances,
it
also
refers
to
the
current
state
of
the
socketfor
instance,
calling
accept
on
a
socket
that
is
not
listening.
WSAEMFILE
10024
Too
many
open
sockets.
Each
implementation
may
have
a
maximum
number
of
socket
handles
available,
either
globally,
per
process,
or
per
thread.
WSAEWOULDBLOCK
10035
This
error
is
returned
from
operations
on
nonblocking
sockets
that
cannot
be
completed
immediately,
for
example
recv
when
no
data
is
queued
to
be
read
from
the
socket.
It
is
a
nonfatal
error,
and
the
operation
should
be
retried
later.
It
is
normal
for
WSAEWOULDBLOCK
to
be
reported
as
the
result
from
Page 31 of 41
Return code/value
Description
calling
connect
on
a
nonblocking
SOCK_STREAM
socket,
since
some
time
must
elapse
for
the
connection
to
be
established.
WSAEINPROGRESS
10036
A
blocking
operation
is
currently
executing.
Windows
Sockets
only
allows
a
single
blocking
operationper-
task
or
threadto
be
outstanding,
and
if
any
other
function
call
is
made
(whether
or
not
it
references
that
or
any
other
socket)
the
function
fails
with
the
WSAEINPROGRESS
error.
WSAEALREADY
10037
An
operation
was
attempted
on
a
nonblocking
socket
with
an
operation
already
in
progressthat
is,
calling
connect
a
second
time
on
a
nonblocking
socket
that
is
already
connecting,
or
canceling
an
asynchronous
request
(WSAAsyncGetXbyY)
that
has
already
been
canceled
or
completed.
WSAENOTSOCK
10038
An
operation
was
attempted
on
something
that
is
not
a
socket.
Either
the
socket
handle
parameter
did
not
reference
a
valid
socket,
or
for
select,
a
member
of
an
fd_set
was
not
valid.
WSAEDESTADDRREQ
10039
A
required
address
was
omitted
from
an
operation
on
a
socket.
For
example,
this
error
is
returned
if
sendto
is
called
with
the
remote
address
of
ADDR_ANY.
WSAEMSGSIZE
10040
A
message
sent
on
a
datagram
socket
was
larger
than
the
internal
message
buffer
or
some
other
network
limit,
or
the
buffer
used
to
receive
a
datagram
was
smaller
than
the
datagram
itself.
WSAEPROTOTYPE
10041
A
protocol
was
specified
in
the
socket
function
call
that
does
not
support
the
semantics
of
the
socket
type
requested.
For
example,
the
ARPA
Internet
UDP
protocol
cannot
be
specified
with
a
socket
type
of
SOCK_STREAM.
WSAENOPROTOOPT
10042
An
unknown,
invalid
or
unsupported
option
or
level
was
specified
in
a
getsockopt
or
setsockopt
call.
WSAEPROTONOSUPPORT
Page 32 of 41
Return code/value
Description
10043
The
requested
protocol
has
not
been
configured
into
the
system,
or
no
implementation
for
it
exists.
For
example,
a
socket
call
requests
a
SOCK_DGRAM
socket,
but
specifies
a
stream
protocol.
WSAESOCKTNOSUPPORT
10044
The
support
for
the
specified
socket
type
does
not
exist
in
this
address
family.
For
example,
the
optional
type
SOCK_RAW
might
be
selected
in
a
socket
call,
and
the
implementation
does
not
support
SOCK_RAW
sockets
at
all.
WSAEOPNOTSUPP
10045
The
attempted
operation
is
not
supported
for
the
type
of
object
referenced.
Usually
this
occurs
when
a
socket
descriptor
to
a
socket
that
cannot
support
this
operation
is
trying
to
accept
a
connection
on
a
datagram
socket.
WSAEPFNOSUPPORT
10046
The
protocol
family
has
not
been
configured
into
the
system
or
no
implementation
for
it
exists.
This
message
has
a
slightly
different
meaning
from
WSAEAFNOSUPPORT.
However,
it
is
interchangeable
in
most
cases,
and
all
Windows
Sockets
functions
that
return
one
of
these
messages
also
specify
WSAEAFNOSUPPORT.
WSAEAFNOSUPPORT
10047
An
address
incompatible
with
the
requested
protocol
was
used.
All
sockets
are
created
with
an
associated
address
family
(that
is,
AF_INET
for
Internet
Protocols)
and
a
generic
protocol
type
(that
is,
SOCK_STREAM).
This
error
is
returned
if
an
incorrect
protocol
is
explicitly
requested
in
the
socket
call,
or
if
an
address
of
the
wrong
family
is
used
for
a
socket,
for
example,
in
sendto.
WSAEADDRINUSE
10048
Typically,
only
one
usage
of
each
socket
address
(protocol/IP
address/port)
is
permitted.
This
error
occurs
if
an
application
attempts
to
bind
a
socket
to
an
IP
address/port
that
has
already
been
used
for
an
existing
socket,
or
a
socket
that
was
not
closed
properly,
or
one
that
is
still
in
the
process
of
closing.
For
server
applications
that
need
to
bind
multiple
sockets
to
the
same
port
number,
consider
using
setsockopt
(SO_REUSEADDR).
Client
applications
usually
need
not
call
bind
at
allconnect
chooses
an
unused
port
automatically.
When
bind
is
called
with
a
wildcard
address
(involving
ADDR_ANY),
a
WSAEADDRINUSE
error
could
be
delayed
until
the
specific
address
is
committed.
This
could
happen
with
a
call
to
another
function
later,
Page 33 of 41
Return code/value
Description
including
connect,
listen,
WSAConnect,
or
WSAJoinLeaf.
WSAEADDRNOTAVAIL
10049
The
requested
address
is
not
valid
in
its
context.
This
normally
results
from
an
attempt
to
bind
to
an
address
that
is
not
valid
for
the
local
computer.
This
can
also
result
from
connect,
sendto,
WSAConnect,
WSAJoinLeaf,
or
WSASendTo
when
the
remote
address
or
port
is
not
valid
for
a
remote
computer
(for
example,
address
or
port
0).
WSAENETDOWN
Network is down.
10050
A
socket
operation
encountered
a
dead
network.
This
could
indicate
a
serious
failure
of
the
network
system
(that
is,
the
protocol
stack
that
the
Windows
Sockets
DLL
runs
over),
the
network
interface,
or
the
local
network
itself.
WSAENETUNREACH
Network is unreachable.
10051
A
socket
operation
was
attempted
to
an
unreachable
network.
This
usually
means
the
local
software
knows
no
route
to
reach
the
remote
host.
WSAENETRESET
10052
The
connection
has
been
broken
due
to
keep-alive
activity
detecting
a
failure
while
the
operation
was
in
progress.
It
can
also
be
returned
by
setsockopt
if
an
attempt
is
made
to
set
SO_KEEPALIVE
on
a
connection
that
has
already
failed.
WSAECONNABORTED
10053
An
established
connection
was
aborted
by
the
software
in
your
host
computer,
possibly
due
to
a
data
transmission
time-out
or
protocol
error.
WSAECONNRESET
10054
An
existing
connection
was
forcibly
closed
by
the
remote
host.
This
normally
results
if
the
peer
application
on
the
remote
host
is
suddenly
stopped,
the
host
is
rebooted,
the
host
or
remote
network
interface
is
disabled,
or
the
remote
host
uses
a
hard
close
(see
setsockopt
for
more
information
on
the
SO_LINGER
option
on
the
remote
socket).
This
error
may
also
result
if
a
connection
was
broken
due
to
keep-alive
activity
detecting
a
failure
while
one
or
more
operations
are
in
progress.
Operations
that
were
in
progress
fail
with
WSAENETRESET.
Subsequent
operations
fail
with
WSAECONNRESET.
WSAENOBUFS
10055
An
operation
on
a
socket
could
not
be
performed
because
the
system
lacked
Page 34 of 41
Return code/value
Description
sufficient
buffer
space
or
because
a
queue
was
full.
WSAEISCONN
10056
A
connect
request
was
made
on
an
already-connected
socket.
Some
implementations
also
return
this
error
if
sendto
is
called
on
a
connected
SOCK_DGRAM
socket
(for
SOCK_STREAM
sockets,
the
to
parameter
in
sendto
is
ignored)
although
other
implementations
treat
this
as
a
legal
occurrence.
WSAENOTCONN
10057
A
request
to
send
or
receive
data
was
disallowed
because
the
socket
is
not
connected
and
(when
sending
on
a
datagram
socket
using
sendto)
no
address
was
supplied.
Any
other
type
of
operation
might
also
return
this
errorfor
example,
setsockopt
setting
SO_KEEPALIVE
if
the
connection
has
been
reset.
WSAESHUTDOWN
10058
A
request
to
send
or
receive
data
was
disallowed
because
the
socket
had
already
been
shut
down
in
that
direction
with
a
previous
shutdown
call.
By
calling
shutdown
a
partial
close
of
a
socket
is
requested,
which
is
a
signal
that
sending
or
receiving,
or
both
have
been
discontinued.
WSAETOOMANYREFS
10059
Too
many
references
to
some
kernel
object.
WSAETIMEDOUT
10060
A
connection
attempt
failed
because
the
connected
party
did
not
properly
respond
after
a
period
of
time,
or
the
established
connection
failed
because
the
connected
host
has
failed
to
respond.
WSAECONNREFUSED
Connection refused.
10061
No
connection
could
be
made
because
the
target
computer
actively
refused
it.
This
usually
results
from
trying
to
connect
to
a
service
that
is
inactive
on
the
foreign
hostthat
is,
one
with
no
server
application
running.
WSAELOOP
10062
Cannot
translate
a
name.
WSAENAMETOOLONG
10063
A
name
component
or
a
name
was
too
long.
WSAEHOSTDOWN
Page 35 of 41
Host is down.
Return code/value
Description
10064
A
socket
operation
failed
because
the
destination
host
is
down.
A
socket
operation
encountered
a
dead
host.
Networking
activity
on
the
local
host
has
not
been
initiated.
These
conditions
are
more
likely
to
be
indicated
by
the
error
WSAETIMEDOUT.
WSAEHOSTUNREACH
No route to host.
10065
A
socket
operation
was
attempted
to
an
unreachable
host.
See
WSAENETUNREACH.
WSAENOTEMPTY
10066
Cannot
remove
a
directory
that
is
not
empty.
WSAEPROCLIM
10067
A
Windows
Sockets
implementation
may
have
a
limit
on
the
number
of
applications
that
can
use
it
simultaneously.
WSAStartup
may
fail
with
this
error
if
the
limit
has
been
reached.
WSAEUSERS
10068
Ran
out
of
user
quota.
WSAEDQUOT
10069
Ran
out
of
disk
quota.
WSAESTALE
10070
The
file
handle
reference
is
no
longer
available.
WSAEREMOTE
Item is remote.
10071
The
item
is
not
available
locally.
WSASYSNOTREADY
10091
This
error
is
returned
by
WSAStartup
if
the
Windows
Sockets
implementation
cannot
function
at
this
time
because
the
underlying
system
it
uses
to
provide
network
services
is
currently
unavailable.
Users
should
check:
That the appropriate Windows Sockets DLL file is in the current path.
That
they
are
not
trying
to
use
more
than
one
Windows
Sockets
implementation
simultaneously.
If
there
is
more
than
one
Winsock
DLL
on
your
system,
be
sure
the
first
one
in
the
path
is
appropriate
for
the
network
subsystem
currently
loaded.
Page 36 of 41
Return code/value
Description
WSAVERNOTSUPPORTED
10092
The
current
Windows
Sockets
implementation
does
not
support
the
Windows
Sockets
specification
version
requested
by
the
application.
Check
that
no
old
Windows
Sockets
DLL
files
are
being
accessed.
WSANOTINITIALISED
10093
Either
the
application
has
not
called
WSAStartup
or
WSAStartup
failed.
The
application
may
be
accessing
a
socket
that
the
current
active
task
does
not
own
(that
is,
trying
to
share
a
socket
between
tasks),
or
WSACleanup
has
been
called
too
many
times.
WSAEDISCON
10101
Returned
by
WSARecv
and
WSARecvFrom
to
indicate
that
the
remote
party
has
initiated
a
graceful
shutdown
sequence.
WSAENOMORE
No more results.
10102
No
more
results
can
be
returned
by
the
WSALookupServiceNext
function.
WSAECANCELLED
10103
A
call
to
the
WSALookupServiceEnd
function
was
made
while
this
call
was
still
processing.
The
call
has
been
canceled.
WSAEINVALIDPROCTABLE
10104
The
service
provider
procedure
call
table
is
invalid.
A
service
provider
returned
a
bogus
procedure
table
to
Ws2_32.dll.
This
is
usually
caused
by
one
or
more
of
the
function
pointers
being
NULL.
WSAEINVALIDPROVIDER
10105
The
requested
service
provider
is
invalid.
This
error
is
returned
by
the
WSCGetProviderInfo
and
WSCGetProviderInfo32
functions
if
the
protocol
entry
specified
could
not
be
found.
This
error
is
also
returned
if
the
service
provider
returned
a
version
number
other
than
2.0.
WSAEPROVIDERFAILEDINIT
10106
The
requested
service
provider
could
not
be
loaded
or
initialized.
This
error
is
Page 37 of 41
Return code/value
Description
returned
if
either
a
service
provider's
DLL
could
not
be
loaded
(LoadLibrary
failed)
or
the
provider's
WSPStartup
or
NSPStartup
function
failed.
WSASYSCALLFAILURE
10107
A
system
call
that
should
never
fail
has
failed.
This
is
a
generic
error
code,
returned
under
various
conditions.
Returned
when
a
system
call
that
should
never
fail
does
fail.
For
example,
if
a
call
to
WaitForMultipleEvents
fails
or
one
of
the
registry
functions
fails
trying
to
manipulate
the
protocol/namespace
catalogs.
Returned
when
a
provider
does
not
return
SUCCESS
and
does
not
provide
an
extended
error
code.
Can
indicate
a
service
provider
implementation
error.
WSASERVICE_NOT_FOUND
10108
No
such
service
is
known.
The
service
cannot
be
found
in
the
specified
name
space.
WSATYPE_NOT_FOUND
10109
The
specified
class
was
not
found.
WSA_E_NO_MORE
No more results.
10110
No
more
results
can
be
returned
by
the
WSALookupServiceNext
function.
WSA_E_CANCELLED
10111
A
call
to
the
WSALookupServiceEnd
function
was
made
while
this
call
was
still
processing.
The
call
has
been
canceled.
WSAEREFUSED
10112
A
database
query
failed
because
it
was
actively
refused.
WSAHOST_NOT_FOUND
11001
No
such
host
is
known.
The
name
is
not
an
official
host
name
or
alias,
or
it
cannot
be
found
in
the
database(s)
being
queried.
This
error
may
also
be
returned
for
protocol
and
service
queries,
and
means
that
the
specified
name
could
not
be
found
in
the
relevant
database.
WSATRY_AGAIN
11002
This
is
usually
a
temporary
error
during
host
name
resolution
and
means
that
the
local
server
did
not
receive
a
response
from
an
authoritative
server.
A
Page 38 of 41
Return code/value
Description
retry
at
some
time
later
may
be
successful.
WSANO_RECOVERY
11003
This
indicates
that
some
sort
of
nonrecoverable
error
occurred
during
a
database
lookup.
This
may
be
because
the
database
files
(for
example,
BSD-
compatible
HOSTS,
SERVICES,
or
PROTOCOLS
files)
could
not
be
found,
or
a
DNS
request
was
returned
by
the
server
with
a
severe
error.
WSANO_DATA
11004
The
requested
name
is
valid
and
was
found
in
the
database,
but
it
does
not
have
the
correct
associated
data
being
resolved
for.
The
usual
example
for
this
is
a
host
name-to-address
translation
attempt
(using
gethostbyname
or
WSAAsyncGetHostByName)
which
uses
the
DNS
(Domain
Name
Server).
An
MX
record
is
returned
but
no
A
recordindicating
the
host
itself
exists,
but
is
not
directly
reachable.
WSA_QOS_RECEIVERS
QOS receivers.
11005
At
least
one
QOS
reserve
has
arrived.
WSA_QOS_SENDERS
QOS senders.
11006
At
least
one
QOS
send
path
has
arrived.
WSA_QOS_NO_SENDERS
No QOS senders.
11007
There
are
no
QOS
senders.
WSA_QOS_NO_RECEIVERS
QOS no receivers.
11008
There
are
no
QOS
receivers.
WSA_QOS_REQUEST_CONFIRMED
QOS
request
confirmed.
11009
The
QOS
reserve
request
has
been
confirmed.
WSA_QOS_ADMISSION_FAILURE
11010
A
QOS
error
occurred
due
to
lack
of
resources.
WSA_QOS_POLICY_FAILURE
11011
The
QOS
request
was
rejected
because
the
policy
system
couldn't
allocate
the
requested
resource
within
the
existing
policy.
WSA_QOS_BAD_STYLE
11012
Page 39 of 41
Return code/value
Description
An
unknown
or
conflicting
QOS
style
was
encountered.
WSA_QOS_BAD_OBJECT
11013
A
problem
was
encountered
with
some
part
of
the
filterspec
or
the
provider-
specific
buffer
in
general.
WSA_QOS_TRAFFIC_CTRL_ERROR
QOS
traffic
control
error.
11014
An
error
with
the
underlying
traffic
control
(TC)
API
as
the
generic
QOS
request
was
converted
for
local
enforcement
by
the
TC
API.
This
could
be
due
to
an
out
of
memory
error
or
to
an
internal
QOS
provider
error.
WSA_QOS_GENERIC_ERROR
11015
A
general
QOS
error.
WSA_QOS_ESERVICETYPE
11016
An
invalid
or
unrecognized
service
type
was
found
in
the
QOS
flowspec.
WSA_QOS_EFLOWSPEC
11017
An
invalid
or
inconsistent
flowspec
was
found
in
the
QOS
structure.
WSA_QOS_EPROVSPECBUF
11018
An
invalid
QOS
provider-specific
buffer.
WSA_QOS_EFILTERSTYLE
11019
An
invalid
QOS
filter
style
was
used.
WSA_QOS_EFILTERTYPE
11020
An
invalid
QOS
filter
type
was
used.
WSA_QOS_EFILTERCOUNT
11021
An
incorrect
number
of
QOS
FILTERSPECs
were
specified
in
the
FLOWDESCRIPTOR.
WSA_QOS_EOBJLENGTH
11022
An
object
with
an
invalid
ObjectLength
field
was
specified
in
the
QOS
provider-
specific
buffer.
WSA_QOS_EFLOWCOUNT
11023
Page 40 of 41
Return code/value
Description
An
incorrect
number
of
flow
descriptors
was
specified
in
the
QOS
structure.
WSA_QOS_EUNKOWNPSOBJ
11024
An
unrecognized
object
was
found
in
the
QOS
provider-specific
buffer.
WSA_QOS_EPOLICYOBJ
11025
An
invalid
policy
object
was
found
in
the
QOS
provider-specific
buffer.
WSA_QOS_EFLOWDESC
11026
An
invalid
QOS
flow
descriptor
was
found
in
the
flow
descriptor
list.
WSA_QOS_EPSFLOWSPEC
11027
An
invalid
or
inconsistent
flowspec
was
found
in
the
QOS
provider-specific
buffer.
WSA_QOS_EPSFILTERSPEC
11028
An
invalid
FILTERSPEC
was
found
in
the
QOS
provider-specific
buffer.
WSA_QOS_ESDMODEOBJ
11029
An
invalid
shape
discard
mode
object
was
found
in
the
QOS
provider-specific
buffer.
WSA_QOS_ESHAPERATEOBJ
11030
An
invalid
shaping
rate
object
was
found
in
the
QOS
provider-specific
buffer.
WSA_QOS_RESERVED_PETYPE
11031
A
reserved
policy
element
was
found
in
the
QOS
provider-specific
buffer.
Page 41 of 41