PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Run on the server, this function is used to wait for a connection request coming from the client sockets.
Notes:
  • If the client computer is using a WINDEV application to connect to this socket, the connection request is performed by SocketConnect.
  • UDP socket: SocketWaitForConnection cannot be used with the UDP sockets.
Reminder: A socket is a communication resource used by the applications to communicate between computers regardless of the network type.
Versions 19 and later
WINDEVLinux This function is now available for the WINDEV applications in Linux.
Linux This function is now available for the WEBDEV sites in Linux.
New in version 19
WINDEVLinux This function is now available for the WINDEV applications in Linux.
Linux This function is now available for the WEBDEV sites in Linux.
WINDEVLinux This function is now available for the WINDEV applications in Linux.
Linux This function is now available for the WEBDEV sites in Linux.
Versions 23 and later
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 23
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Example
WINDEVUser code (UMC)
// Creates a socket on the server
IF SocketCreate("Server", 8000) = False THEN
Error("Creation error " + ErrorInfo(errMessage))
ELSE
// Manage the connections of the client computers in a thread
ThreadExecute("Thread1", threadNormal, WaitProcedure)
END

//-----------------------------

PROCEDURE WaitProcedure()
LOOP
//Windows ends the current processes, gives control back to the WINDEV application
// then takes into account the mouse clicks and the actions performed on the keyboard keys.
Multitask(0)

IF SocketWaitForConnection("Server") THEN
Channel is string
// If the connection is accepted,
// this connection is managed in a specific thread
Channel = SocketAccept("Server")
ThreadExecute(Channel, threadNormal, ProcedureManagement, Channel)
END
END
WINDEVUser code (UMC)
// Creates a socket on the server
IF SocketCreate("Server", 8000) = False THEN
Error("Creation error " + ErrorInfo(errMessage))
ELSE
// Manage the connections of the client computers in a thread
ThreadExecute("Thread1", threadNormal, WaitProcedure)
END


INTERNAL PROCEDURE WaitProcedure()
LOOP
// Windows ends the current processes, gives control back to the WINDEV application
// then takes into account the mouse clicks and the actions performed on the keyboard keys.
Multitask(0)

IF SocketWaitForConnection("Server") THEN
Channel is string
// If the connection is accepted,
// this connection is managed in a specific thread
Channel = SocketAccept("Server")
ThreadExecute(Channel, threadNormal, ProcedureManagement, Channel)
END
END
END
Syntax
<Result> = SocketWaitForConnection(<Socket Name> [, <Maximum Duration>])
<Result>: Boolean
  • True: a new request for connection is pending.
  • False: no request for connection was detected.
<Socket Name>: Character string (with quotes)
Name of the server socket that waits for the connection.
WINDEV Caution: The socket name is case sensitive.
<Maximum Duration>: Optional integer or optional Duration
Maximum time-out (in milliseconds).
  • This function is a locking function during the specified duration or until a connection request is detected.
  • If this parameter is not specified, the function locks the application until the next attempt to connect.
Note: if this function is used in multi-thread mode, the function only locks the thread in which it is called.
This parameter can correspond to:
  • an integer corresponding to the number of milliseconds,
  • a Duration variable,
  • Versions 23 and later
    the direct indication of duration (1 s or 10 ms for example).
    New in version 23
    the direct indication of duration (1 s or 10 ms for example).
    the direct indication of duration (1 s or 10 ms for example).
Remarks
Component : wd240com.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment