Perancangan Perangkat Lunak Remote Komputer Pada Jaringan Local Area Network (LAN) Berbasis Short Message Service (SMS)

  

Lampiran -A Listing Program

1. Server

  Dim strBuff1 As String Dim strBuff2 As String Dim StrBuff As String Dim Status As String Dim timerCounter As Integer Private Sub ListComPorts() Dim i As Integer cboComm.Clear For i = 1 To 16 If COMAvailable(i) Then cboComm.AddItem i End If Next Text1.Text = cboComm.Text End Sub Private Sub StartListening() tcpSvr.Close tcpSvr.LocalPort = 3458 tcpSvr.Listen End Sub Private Sub StopListening() Dim x As Integer For x = 0 To 3 If tcpClt(x).State = sckConnected Then tcpClt(x).Close Next tcpSvr.Close ListView1.ListItems.Clear End Sub Private Sub cboComm_Click() Text1.Text = cboComm.Text End Sub Public Sub SendSMSNum() noTlpAdmin.Text = "+6281260555092" 'Text3.SelText = "AT+CMGS=" & """" & noTlpAdmin.Text & """" & vbCr MSComm1.Output = "AT+CMGS=" & """" & noTlpAdmin.Text & """" & vbCr End Sub Public Sub DeleteSMS() If txtNumSMS.Text <> "" Then 'Text3.SelText = "AT+CMGD=" & txtNumSMS & vbCr

  MSComm1.Output = "AT+CMGD=" & txtNumSMS & vbCr End If End Sub Public Sub SendSMSText() Dim text_message As String If Status = "SHT SERVER DONE" Then text_message = "Server shutdown" ElseIf Status = "RES SERVER DONE" Then text_message = "Server restart" ElseIf Status = "LOF SERVER DONE" Then text_message = "Server log off" ElseIf Status = "SHT CLIENT DONE" Then text_message = "Client shutdown" ElseIf Status = "RES CLIENT DONE" Then text_message = "Client restart" ElseIf Status = "LOF CLIENT DONE" Then text_message = "Client log off" ElseIf Status = "STS DONE" Then text_message = Text4.Text ElseIf Status = "REM DONE" Then text_message = Text4.Text End If Status = "" 'coba Text6.Text = text_message Text3.SelText = text_message & vbCr MSComm1.Output = text_message & Chr(26) End Sub Private Sub Command1_Click() With MSComm1 .CommPort = Val(Text1.Text) .Settings = "9600,N,8,1" .RThreshold = 1 .InputLen = 1 .PortOpen = True .InBufferCount = 0 End With Timer1.Enabled = True Command1.Enabled = False End Sub Private Sub Form_Load() Dim x As Integer Dim y As Integer

  ' untuk setting awal modem Status = "AWAL" timerCounter = 0 ListComPorts ' untuk setting awal winsock server 'For y = 1 To 3 ' indeks 0 sudah lsg di-load jadi skrg d load 1-3 ' Load tcpServer(y) 'Next For x = 1 To 3 Load tcpClt(x) tcpClt(x).Close Next ListView1.ListItems.Clear StartListening End Sub Private Sub Form_Unload(Cancel As Integer) Dim x As Integer 'tutup modem If MSComm1.PortOpen = True Then MSComm1.PortOpen = False 'tutup winsock 'For x = 0 To 3 ' tcpServer(x).Close 'Next StopListening End Sub Private Sub MSComm1_OnComm() ' using event Method Dim InBuff As String Select Case MSComm1.CommEvent ' Handle each event or error by placing code below each case statement.

  ' This template is found in the Example section of the OnComm event Help topic ' in VB Help. ' Errors Case comEventBreak ' A Break was received. Case comEventCDTO ' CD (RLSD) Timeout. Case comEventCTSTO ' CTS Timeout.

  Case comEventDSRTO ' DSR Timeout. Case comEventFrame ' Framing Error. Case comEventOverrun ' Data Lost. Case comEventRxOver ' Receive buffer overflow. Case comEventRxParity ' Parity Error. Case comEventTxFull ' Transmit buffer full. Case comEventDCB ' Unexpected error retrieving DCB] ' Events Case comEvCD ' Change in the CD line.

  Case comEvCTS ' Change in the CTS line. Case comEvDSR ' Change in the DSR line. Case comEvRing ' Change in the Ring Indicator. Case comEvReceive ' Received RThreshold # of chars. InBuff = MSComm1.Input Call HandleInput(InBuff) Case comEvSend ' There are SThreshold number of ' characters in the transmit buffer.

  Case comEvEOF ' An EOF character was found in the ' input stream. End Select End Sub Sub HandleInput(InBuff As String) Text3.SelText = InBuff Text2.Text = Text2.Text & InBuff If MSComm1.InBufferCount = 0 Then processText End If End Sub Public Sub processText() If InStr(Text2.Text, "CMTI") <> 0 Then txtNumSMS.Text = GetNumSMS(Text2.Text) Text2.Text = "" ReadCMTI (txtNumSMS.Text) ElseIf InStr(Text2.Text, "CMGR:") <> 0 Then ReadCMGR (Text2.Text) Text2.Text = "" ElseIf InStr(Text2.Text, "CMGS:") <> 0 Then DeleteSMS Text2.Text = "" Else Text2.Text = ""

  End If End Sub Public Sub ReadCMTI(IndexSMS As String) 'Text3.SelText = "AT+CMGR=" & txtNumSMS.Text MSComm1.Output = "AT+CMGR=" & IndexSMS End Sub Public Sub ReadCMGR(BufferMessage As String) Dim tData As String Dim tChar As String Dim lQuoteNum As Long Dim tRead As String Dim tSender As String Dim tDateTime As String Dim tMessage As String Dim i As Long tData = BufferMessage If tData <> "" Then For i = 1 To Len(tData) tChar = Mid(tData, i, 1) If tChar = """" Then lQuoteNum = lQuoteNum + 1 If lQuoteNum = 1 And tChar <> """" Then tRead = tRead & tChar If lQuoteNum = 3 And tChar <> """" Then tSender = tSender & tChar If lQuoteNum = 5 And tChar <> """" Then tDateTime = tDateTime & tChar If lQuoteNum = 6 And tChar <> """" Then tMessage = tMessage & tChar Next i tDate = Left(tDateTime, 8) tTime = Mid(tDateTime, 10, 8) noTlpAdmin.Text = Trim(tSender) tMessage = Mid(tMessage, 3) tMessage = Mid(tMessage, 1, InStr(tMessage, vbCr) - 1) End If IsiSMS.Text = tMessage ProcessMessage End Sub Public Sub ProcessMessage() Dim key_word As String Dim mid_word As String If IsiSMS <> "" Then key_word = Left(UCase(IsiSMS.Text), 3) Text6.Text = key_word mid_word = Trim(Right(UCase(IsiSMS.Text), Len(IsiSMS.Text) - Len(key_word))) End If Select Case key_word Case "SHT" If Trim(mid_word) = "SERVER" Then DeleteSMS Status = "SHT SERVER DONE" Shell ("shutdown -s -f") Else shutdownClient (mid_word) Status = "SHT CLIENT DONE" DeleteSMS End If HasilProses.Text = "Shutdown " Case "RES" If Trim(mid_word) = "SERVER" Then DeleteSMS Status = "RES SERVER DONE" Shell ("shutdown -r -f") Else restartClient (mid_word) Status = "RES CLIENT DONE" DeleteSMS End If HasilProses.Text = "Restart " Case "LOF" If Trim(mid_word) = "SERVER" Then DeleteSMS Status = "LOF SERVER DONE" Shell ("shutdown -l -f") Else logoffClient (mid_word) Status = "LOF CLIENT DONE" DeleteSMS End If HasilProses.Text = "Log off" Case "STS" HasilProses.Text = "view status" Call getStsConnectedClient Case "REM" HasilProses.Text = "hapus client" If Trim(mid_word) <> "" Then removeClient (mid_word) DeleteSMS End If End Select End Sub

  Private Sub tcpClt_Close(Index As Integer) Dim iList As ListItem Set iList = ListView1.FindItem(tcpClt(Index).RemoteHostIP) If Not iList Is Nothing Then ListView1.ListItems.Remove (iList.Index) End If tcpClt(Index).Close End Sub Private Sub tcpSvr_ConnectionRequest(ByVal requestID As Long) Dim x As Integer Dim iList As ListItem For x = 0 To 3 If Not tcpClt(x).State = sckConnected Then tcpClt(x).Close tcpClt(x).Accept requestID Set iList = ListView1.ListItems.Add(, , tcpClt(x).RemoteHostIP) iList.SubItems(1) = tcpClt(x).RemotePort 'Text2.Text = tcpClt(x).State Exit For End If Next End Sub Private Sub Timer1_Timer() timerCounter = timerCounter + 1 If Status = "AWAL" Then If timerCounter = 2 Then 'Text3.SelText = "AT" MSComm1.Output = "AT" & vbCr ElseIf timerCounter = 4 Then 'Text3.SelText = "AT+CGMI" MSComm1.Output = "AT+CGMI" & vbCr ElseIf timerCounter = 6 Then 'Text3.SelText = "AT+CGMM" MSComm1.Output = "AT+CGMM" & vbCr ElseIf timerCounter = 8 Then 'Text3.SelText = "AT+CMGF=1" MSComm1.Output = "AT+CMGF=1" & vbCr 'untuk set text mode ElseIf timerCounter = 10 Then 'Text3.SelText = "AT+CPMS=""ME""" MSComm1.Output = "AT+CPMS=""ME""" & vbCr timerCounter = 0 Status = "LOAD SELESAI" Timer1.Enabled = False

  End If End If End Sub Private Sub Timer2_Timer() timerCounter = timerCounter + 1 If timerCounter = 14 Then SendSMSNum ElseIf timerCounter = 16 Then SendSMSText ElseIf timerCounter = 22 Then timerCounter = 0 Timer2.Enabled = False End If End Sub Private Sub WaitSMS_Click() MSComm1.Output = "AT+CMGF=1" & vbCr MSComm1.Output = "AT+CMGR=18" & vbCr End Sub Private Function GetNumSMS(IncomeBuffer As String) As String Dim NumSMS As String Dim a As String a = InStr(IncomeBuffer, ",") If InStr(IncomeBuffer, "CMTI") <> 0 Then NumSMS = Trim(Right(IncomeBuffer, Len(IncomeBuffer) - Val(a))) Else NumSMS = 0 End If GetNumSMS = NumSMS End Function Public Sub getStsConnectedClient() Dim iList As ListItem Dim x As Integer Text4.Text = "" For x = 0 To 3 If tcpClt(x).State = sckConnected Then Text4.Text = Text4.Text & tcpClt(x).RemoteHostIP & "; " End If Next If Text4.Text <> "" Then Status = "STS DONE" Text4.Text = "Client yang terkoneksi: " & Text4.Text timerCounter = 11 Timer2.Enabled = True

  End If End Sub Public Sub removeClient(IPClient As String) Dim x As Integer Dim iList As ListItem Text4.Text = "" For x = 0 To 3 If tcpClt(x).RemoteHostIP = IPClient Then Set iList = ListView1.FindItem(tcpClt(x).RemoteHostIP) If Not iList Is Nothing Then ListView1.ListItems.Remove (iList.Index) End If tcpClt(x).Close 'Text5.Text = tcpClt(x).State 'If tcpClt(x).State <> sckConnected Then ' Text4.Text = "Program pada " & IPClient & " tidak terkoneksi sekarang" 'End If Exit For End If Next 'If Text4.Text <> "" Then ' Status = "REM DONE" ' timerCounter = 11 ' Timer2.Enabled = True 'End If End Sub Public Function getIndexTcpSvr(IpAdd As String) As Integer Dim x As Integer Dim StatusIndex As String For x = 0 To 3 If tcpClt(x).RemoteHostIP = IpAdd Then getIndexTcpSvr = x StatusIndex = "ada" Exit For End If Next If StatusIndex <> "ada" Then getIndexTcpSvr = -1 End Function Public Sub shutdownClient(IPClient As String) Dim x As Integer x = getIndexTcpSvr(IPClient)

  If x <> -1 Then tcpClt(x).SendData "SHUTDOWN" End If End Sub Public Sub restartClient(IPClient As String) Dim x As Integer x = getIndexTcpSvr(IPClient) If x <> -1 Then tcpClt(x).SendData "RESTART" End If End Sub Public Sub logoffClient(IPClient As String) Dim x As Integer x = getIndexTcpSvr(IPClient) If x <> -1 Then tcpClt(x).SendData "LOGOFF" End If End Sub

2. Client 1

  Private Sub cmdConnect_Click() tcpClient.Close tcpClient.RemoteHost = InputBox("Masukkan IP address", "IP Address", "127.0.0.1") tcpClient.RemotePort = 3458 tcpClient.Connect End Sub Private Sub Form_Load() Dim x As Integer End Sub Private Sub Form_Unload(Cancel As Integer) tcpClient.Close End Sub Private Sub tcpClient_Close() tcpClient.Close cmdConnect.Enabled = True Label1.Caption = "tidak ada koneksi" End Sub Private Sub tcpClient_Connect() MsgBox "Berhasil" 'Text1.Text = tcpClient.State If tcpClient.State = sckConnected Then Label1.Caption = "Sukses melakukan koneksi dengan server" cmdConnect.Enabled = False End If End Sub Private Sub tcpClient_DataArrival(ByVal bytesTotal As Long) Dim teksSMS As String teksSMS = "" tcpClient.GetData teksSMS Text1.Text = teksSMS If teksSMS <> "" Then processSMS (teksSMS) End Sub Public Sub processSMS(pesan As String) Dim key_word As String 'key_word = Left(UCase(pesan), 3) key_word = Trim(pesan) Select Case key_word Case "SHUTDOWN" Text1.Text = Text1.Text & " shutdown-ing" tcpClient.Close Shell ("shutdown -s -f") Case "RESTART" Text1.Text = Text1.Text & " restart-ing" tcpClient.Close Shell ("shutdown -r -f") Case "LOGOFF" Text1.Text = Text1.Text & " loging off" tcpClient.Close Shell ("shutdown -l -f") End Select End Sub Private Sub tcpClient_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean) MsgBox "Gagal : " & Description

  'Text1.Text = tcpClient.State cmdConnect.Enabled = True Label1.Caption = "tidak ada koneksi" End Sub 3.

  Client 2 Private Sub cmdConnect_Click() tcpClient.Close tcpClient.RemoteHost = InputBox("Masukkan IP address", "IP Address", "127.0.0.1") tcpClient.RemotePort = 3458 tcpClient.Connect End Sub Private Sub Form_Load() Dim x As Integer End Sub Private Sub Form_Unload(Cancel As Integer) tcpClient.Close End Sub Private Sub tcpClient_Close() tcpClient.Close cmdConnect.Enabled = True Label1.Caption = "tidak ada koneksi" End Sub Private Sub tcpClient_Connect() MsgBox "Berhasil" 'Text1.Text = tcpClient.State If tcpClient.State = sckConnected Then Label1.Caption = "Sukses melakukan koneksi dengan server" cmdConnect.Enabled = False End If End Sub Private Sub tcpClient_DataArrival(ByVal bytesTotal As Long) Dim teksSMS As String teksSMS = "" tcpClient.GetData teksSMS Text1.Text = teksSMS If teksSMS <> "" Then processSMS (teksSMS) End Sub Public Sub processSMS(pesan As String) Dim key_word As String 'key_word = Left(UCase(pesan), 3) key_word = Trim(pesan) Select Case key_word Case "SHUTDOWN" Text1.Text = Text1.Text & " shutdown-ing" tcpClient.Close Shell ("shutdown -s -f") Case "RESTART" Text1.Text = Text1.Text & " restart-ing" tcpClient.Close Shell ("shutdown -r -f") Case "LOGOFF" Text1.Text = Text1.Text & " loging off" tcpClient.Close Shell ("shutdown -l -f") End Select End Sub Private Sub tcpClient_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean) MsgBox "Gagal : " & Description 'Text1.Text = tcpClient.State cmdConnect.Enabled = True Label1.Caption = "tidak ada koneksi" End Sub

  Reza El Fahmi S.kom Jl.Kenanga I, No 22, Komplek AAF, Kreungeukuh Kab.Aceh Utara, NAD Hp : 085762568189

DAFTAR RIWAYAT HIDUP

  Data pribadi : Nama : Reza El Fahmi S.kom Umur : 25 Tahun Tempat tanggal Lahir : Medan, 20 Mei 1988 Jenis Kelamin : Laki-laki Telp/Hp : 085762568189 Agama : Islam Status : Belum Menikah Alamat : Jl.Kenanga I, No 22, Komplek AAF, Kreungeukuh

  Kab.Aceh Utara, NAD Pendidikan : 1994 - 2000 : SD Negeri 060825 Medan

  2000 - 2003 : SMP Negeri I Lhokseumawe NAD 2003 - 2006 : SMA Negeri I Lhokseumawe NAD 2006 – 2013 : Universitas Sumatera Utara

  Kemampuan :

  • Kemampuan Komputer ( Operasi Windows, Ms Office dan Internet )
  • Kemampuan di bidang Hardware dan Software komputer,
  • Mengikuti beberapa Kursus :

  How to build augmented Reality For Mobile Application

  • Swisscontact Multi Donor Fund -

  Tenaga Teknis PNPM Mandiri

  • Pengalaman menjadi teknisi komputer di beberapa warnet di daerah Sumater Utara.

  Kualifikasi :

  • Mempunyai sikap yang ingin maju, berinisiatif, motivasi yang tinggi, berpendirian, jujur dan bertanggung jawab terhadap pekerjaan.
  • Mau berkerja keras dan belajar tentang hal – hal yang baru.

  • Bersedia dikritik dan menerima saran yang membangun tentang pekerjaan.
  • Bersedia dan mampu bekerja dalam team work, bersedia dipimpin dan mampu memimpin.

  Hormat saya, Reza El Fahmi S.kom