• Tidak ada hasil yang ditemukan

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

N/A
N/A
Protected

Academic year: 2019

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

Copied!
15
0
0

Teks penuh

(1)

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

(2)

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

(3)

' 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

(4)

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

(5)

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

(6)
(7)

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

(8)

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

(9)

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

(10)

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

(11)

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

(12)

'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

(13)

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

(14)

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. Kab.Aceh Utara, NAD

(15)

• Bersedia dikritik dan menerima saran yang membangun tentang pekerjaan.

• Bersedia dan mampu bekerja dalam team work, bersedia dipimpin dan mampu memimpin.

Hormat saya,

Referensi

Dokumen terkait

ANALISIS KONTRIBUSI PENDAPATAN ASLI DAERAH TERHADAP BELANJA MODAL PADA PEMERINTAHAN DAERAH KABUPATEN / KOTA PROVINSI JAWA TIMUR ; Nora Devi Yanti; 110810301040;

Definisi yang lain menyebutkan multimedia adalah pemanfaatan computer untuk membuat dan menggabungkan teks, grafik, audio, gambar bergerak (video dan animasi) dengan

Alat ukur yang digunakan adalah angket untuk mengukur data yang berkaitan dengan variabel variabel minat belajar, sikap siswa terhadap pelajaran

táblázat: A bükk fafaj átmérő szerinti, régi választékszerkezetének aktualizálása egy későbbi, összesített választékszerkezet adatai segítségével.. Table 8:

Penulis berharap dapat memberikan gambaran mengenai pengaruh konservatisme akuntansi, voluntary disclosure dan ukuran perusahaan terhadap earning response coefficient

Its characteristics make the designed method particularly suitable for remote sensing and video-surveillance applications, especially in those contexts where

Hasil Penelitian: hasil penelitian menunjukkan ada hubungan tingkat depresi dengan aktivitas seksual pada lansia di Desa Sanggrahan Condongcatur Depok Sleman

Salah satu keluhan yang ditemukan pada pekerja dengan paparan getaran di kegiatan industrialisasi adalah keluhan berupa kulit pucat, mati rasa terhadap suhu atau sentuhan yang