web development India freelance website designer
Whenever you are using the Winsock, no doubt you'll be sending strings and other data across an open connection.
However, occasioanlly, for one reason or another, your connection will close, and you won't know about it. If you then try
to send data across that connection, your program will error and die. To solve this, I wrote a generic function to use, so
that data is always sent safely. If data is sent fine, it returns true, if there's an error, it returns false.

Public Function WinsockSend(pSock As Winsock, ByVal Data As String)
' send the data on the passed winsock
If pSock.State = sckConnected Then
' send the data and return true
pSock.SendData Data
DoEvents
WinsockSend = True
Else
' return false because we're not connected
WinsockSend = False
End If
End Function

If I had a Winsock called sckMain I would call it like this:

' instead of using this to send data
If sckMain.State = sckConnected Then
sckMain.SendData strData
DoEvents
End If

' i can use this
blnRetVal = WinsockSend(sckMain, strData)

Then after you've made the call to WinsockSend, you can check the value of blnRetVal to see if the send was
successful or not. Simple.
Safely Send A String

1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550

Freelance ASP PHP web development | Web developer India Web development India| Prayagasoft - web designer India, Ecommerce developer india, Ecommerce design