Repository navigation
Expand file tree
/
Copy pathclient_file_transfer.frm
More file actions
180 lines (168 loc) · 4.95 KB
/
Copy pathclient_file_transfer.frm
File metadata and controls
180 lines (168 loc) · 4.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
VERSION 5.00
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "mswinsck.ocx"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form frmClient
BackColor = &H00000000&
BorderStyle = 1 'Fixed Single
Caption = "Dosya Gönder"
ClientHeight = 1275
ClientLeft = -15
ClientTop = 270
ClientWidth = 5175
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1275
ScaleWidth = 5175
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton Command2
Caption = "Ýlk Gönderimde Servera Klasör Aç"
Height = 435
Left = 120
TabIndex = 5
Top = 600
Width = 2055
End
Begin VB.CommandButton Command1
Caption = "Gönderileni Çalýþtýr."
Height = 435
Left = 2520
TabIndex = 4
Top = 480
Width = 1455
End
Begin MSWinsockLib.Winsock wsTCP
Index = 0
Left = 120
Top = 480
_ExtentX = 741
_ExtentY = 741
_Version = 393216
End
Begin VB.CommandButton cmdSend
Caption = "Gönder"
Height = 435
Left = 1200
TabIndex = 2
Top = 480
Width = 1215
End
Begin MSComDlg.CommonDialog dlg
Left = 600
Top = 480
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.CommandButton cmdBrowse
Caption = "Dosya Seç"
Height = 315
Left = 3840
TabIndex = 1
Top = 120
Width = 1215
End
Begin VB.TextBox txtFile
Appearance = 0 'Flat
BackColor = &H00000000&
ForeColor = &H0000FF00&
Height = 315
Left = 120
TabIndex = 0
Top = 120
Width = 3615
End
Begin VB.Label lblStatus
BorderStyle = 1 'Fixed Single
Height = 315
Left = 0
TabIndex = 3
Top = 960
Width = 5175
End
End
Attribute VB_Name = "frmClient"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'==============================================
'Written by Igor Ostrovsky (igor@ostrosoft.com)
'Visual Basic 911 (http://www.ostrosoft.com/vb)
'==============================================
Option Explicit
Dim buffer() As Byte
Dim lBytes As Long
Dim temp As String
Private Sub cmdBrowse_Click()
dlg.ShowOpen
txtFile = dlg.FileName
End Sub
Private Sub cmdSend_Click()
cmdSend.Enabled = False
lBytes = 0
ReDim buffer(FileLen(dlg.FileName) - 1)
Open dlg.FileName For Binary As 1
Get #1, 1, buffer
Close #1
Load wsTCP(1)
wsTCP(1).RemoteHost = Form1.Text1.Text
wsTCP(1).RemotePort = 1199
wsTCP(1).Connect
lblStatus = "Baðlanýyor..."
End Sub
Private Sub Command1_Click()
On Error Resume Next
Form1.Winsock1.SendData "gonderilen_calistir"
End Sub
Private Sub Command2_Click()
On Error Resume Next
Form1.Winsock1.SendData "klasor_ac"
End Sub
Private Sub Form_Load()
On Error Resume Next
Form1.Winsock1.SendData "klasor_ac"
Command2.Visible = False
End Sub
Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
Form1.Winsock1.SendData "islem|" + "DOSYA TRANSFERÝ KAPATILDI"
End Sub
Private Sub wsTCP_Close(Index As Integer)
On Error Resume Next
lblStatus = "Baðlantý Kapatýldý"
Unload wsTCP(1)
End Sub
Private Sub wsTCP_Connect(Index As Integer)
On Error Resume Next
lblStatus = "Baðlanýldý"
wsTCP(1).SendData dlg.FileTitle & vbCrLf
End Sub
Private Sub wsTCP_DataArrival(Index As Integer, ByVal bytesTotal As Long)
On Error Resume Next
wsTCP(1).GetData temp
If InStr(temp, vbCrLf) <> 0 Then temp = Left(temp, InStr(temp, vbCrLf) - 1)
If temp = "OK" Then
wsTCP(1).SendData buffer
Else
lblStatus = "Something wrong"
Unload wsTCP(1)
cmdSend.Enabled = True
End If
End Sub
Private Sub wsTCP_SendComplete(Index As Integer)
On Error Resume Next
If temp = "OK" Then
lblStatus = "Gönderme Tamamlandý"
temp = ""
Unload wsTCP(1)
cmdSend.Enabled = True
End If
End Sub
Private Sub wsTCP_SendProgress(Index As Integer, ByVal bytesSent As Long, ByVal bytesRemaining As Long)
On Error Resume Next
If temp = "OK" Then
lBytes = lBytes + bytesSent
lblStatus = lBytes & " out of " & UBound(buffer) & " byte gönderildi"
End If
End Sub