My PC's ethernet card supports wake on LAN, and I want to write a small VB app to wake up my PC remotely so I can connect to the VNC server I have running on it. I don't like to leave my computer on all the time.
How would I go about doing this? DSLReports.com has a web based tool that will do it, but I want it coded into my program for simplicity.
I should mention that the PC is not within the same subnet and so I need to send the code over the Internet. I found some really short code that will send the wake up over a subnet using Winsock, and if I can adapt the Winsock control to send it to a specific IP address, that would be brilliant.
VB Code:
'in a form with a command button and textbox Private Sub Command1_Click() Dim data As String data = "FFFFFFFFFFFF" For i = 1 To 16 data = data & Text1.Text Next i data = data + hex2ascii(data) Winsock1.SendData (data) End Sub Public Function hex2ascii(ByVal hextext As String) As String For Y = 1 To Len(hextext) num = Mid(hextext, Y, 2) Value = Value & Chr(Val("&h" & num)) Y = Y + 1 Next Y hex2ascii = Value End Function




Reply With Quote