Sample code for 30+ languages & platforms
Classic ASP

Receive Bytes up to a Delimiter into a BinData

See more Socket/SSL/TLS Examples

Demonstrates Socket.ReceiveUntilByteBd, which reads bytes until a delimiter byte is encountered and appends all bytes up to and including the delimiter to a BinData.

Background. The delimiter is a raw byte value from 0 through 255. This is useful for framing schemes that terminate each message with a known delimiter byte.

Chilkat Classic ASP Downloads

Classic ASP
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
success = 0

set socket = Server.CreateObject("Chilkat.Socket")

'  Connect to the server using TLS.
bTls = 1
maxWaitMs = 5000
success = socket.Connect("example.com",5000,bTls,maxWaitMs)
If (success = 0) Then
    Response.Write "<pre>" & Server.HTMLEncode( socket.LastErrorText) & "</pre>"
    Response.End
End If

'  Read bytes until the delimiter byte is encountered, appending all bytes up to and including the
'  delimiter to a BinData.  The delimiter is a raw byte value from 0 through 255 (here the linefeed
'  byte, decimal 10).
set bd = Server.CreateObject("Chilkat.BinData")
success = socket.ReceiveUntilByteBd(10,bd)
If (success = 0) Then
    Response.Write "<pre>" & Server.HTMLEncode( socket.LastErrorText) & "</pre>"
    Response.End
End If

Response.Write "<pre>" & Server.HTMLEncode( "Received " & bd.NumBytes & " bytes (including the delimiter).") & "</pre>"

%>
</body>
</html>