Click here to Skip to main content
15,887,683 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Printer control function for VB.NET linking EPSON TM-U220 and TM-T88IV Recept Printer Pin
drexler_kk22-Apr-08 20:12
drexler_kk22-Apr-08 20:12 
GeneralRe: Printer control function for VB.NET linking EPSON TM-U220 and TM-T88IV Recept Printer Pin
Chinners23-Apr-08 0:51
Chinners23-Apr-08 0:51 
GeneralRe: Printer control function for VB.NET linking EPSON TM-U220 and TM-T88IV Recept Printer Pin
drexler_kk23-Apr-08 19:29
drexler_kk23-Apr-08 19:29 
GeneralHelp with code Pin
muscle22-Apr-08 16:17
muscle22-Apr-08 16:17 
GeneralRe: Help with code Pin
leckey22-Apr-08 16:24
leckey22-Apr-08 16:24 
GeneralRe: Help with code Pin
muscle22-Apr-08 16:28
muscle22-Apr-08 16:28 
GeneralRe: Help with code Pin
Christian Graus22-Apr-08 16:39
protectorChristian Graus22-Apr-08 16:39 
Generalmake a server application problem Pin
shee_dee8622-Apr-08 15:20
shee_dee8622-Apr-08 15:20 
Imports System
Imports System.Net
Imports System.Net.Sockets
Imports System.Text
Imports System.Threading
Imports System.IO
Imports System.ComponentModel

Public Class Form1
Public Delegate Sub UpdateTextBox(ByVal Text As String)
Dim tagid As String
Dim tcpClient As New System.Net.Sockets.TcpClient
Dim networkStream As NetworkStream
Dim buffer(1024) As Byte
Dim Synchronizer As ISynchronizeInvoke
Dim MyUpdateTextBox As UpdateTextBox
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim buf() As Byte
buf = Encoding.ASCII.GetBytes(TextBox1.Text.Trim())
Try
networkStream.Write(buf, 0, buf.Length)
Catch ex As Exception
MessageBox.Show(ex.ToString())
End Try
TextBox1.Clear()
TextBox1.Focus()
End Sub
Private Sub MyReadCallback(ByVal ar As IAsyncResult)
Dim buffer() As Byte
Dim Read As Integer
Dim Data As String
Try
buffer = ar.AsyncState
Read = networkStream.EndRead(ar)
Data = Encoding.ASCII.GetString(buffer, 0, Read)
networkStream.BeginRead(buffer, 0, buffer.Length, New AsyncCallback(AddressOf MyReadCallback), buffer)
Catch ex As Exception
Data = ex.ToString()
End Try
If (Synchronizer.InvokeRequired = False) Then
TextBox2.Text = TextBox2.Text & Data
Else
Synchronizer.Invoke(MyUpdateTextBox, New Object() {Data})
End If
End Sub
Private Sub UpdateTextBoxDelegate(ByVal Text As String)
TextBox2.Text = TextBox2.Text & Text
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim sendBytes("!quit!".Length + 1) As Byte
Try
sendBytes = Encoding.ASCII.GetBytes("!quit!")
networkStream.Write(sendBytes, 0, sendBytes.Length)
networkStream.Close()
tcpClient.Close()
Application.Exit()
Catch ex As Exception
tcpClient.Close()
Me.Close()
End Try
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim ipAddress As String
Dim port As String
Try
MyUpdateTextBox = New UpdateTextBox(AddressOf UpdateTextBoxDelegate)
ipAddress = TextBox3.Text
port = TextBox4.Text
tcpClient.Connect(ipAddress, port)
MessageBox.Show("connected")
networkStream.BeginRead(buffer, 0, buffer.Length, New AsyncCallback(AddressOf MyReadCallback), buffer)

Synchronizer = Me.TextBox2
Button1.Enabled = True
Button4.Enabled = True
Catch ex As Exception
MsgBox("Cannot connect to the specified address or port")
End Try
End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
TextBox2.Clear()
End Sub
End Class
_________________________________________________________________________
this is sample of my client application using tcpclient,
then the prob here how can i make a server application by manipulate the code above, anyone have idea what should i do now? please..
GeneralRe: make a server application problem Pin
Christian Graus22-Apr-08 15:52
protectorChristian Graus22-Apr-08 15:52 
QuestionPrint to PDF & Printer Pin
SentencedToLive22-Apr-08 13:32
SentencedToLive22-Apr-08 13:32 
GeneralRe: Print to PDF & Printer Pin
Christian Graus22-Apr-08 13:59
protectorChristian Graus22-Apr-08 13:59 
GeneralRe: Print to PDF & Printer Pin
SentencedToLive22-Apr-08 15:33
SentencedToLive22-Apr-08 15:33 
GeneralRe: Print to PDF & Printer Pin
Christian Graus22-Apr-08 15:51
protectorChristian Graus22-Apr-08 15:51 
GeneralRe: Print to PDF & Printer Pin
SentencedToLive23-Apr-08 0:18
SentencedToLive23-Apr-08 0:18 
GeneralRe: Print to PDF & Printer Pin
Christian Graus23-Apr-08 0:59
protectorChristian Graus23-Apr-08 0:59 
GeneralRe: Print to PDF & Printer Pin
Duncan Edwards Jones24-Apr-08 5:55
professionalDuncan Edwards Jones24-Apr-08 5:55 
Generalcreate CV (who find the work, send to cv(person information) to company) Pin
Member 387528422-Apr-08 10:49
Member 387528422-Apr-08 10:49 
GeneralRe: create CV (who find the work, send to cv(person information) to company) Pin
Christian Graus22-Apr-08 12:08
protectorChristian Graus22-Apr-08 12:08 
QuestionHow to get PID,VID from an USB device ? Pin
ArjunMK22-Apr-08 8:07
ArjunMK22-Apr-08 8:07 
QuestionUnable to debug dll Pin
Trevortni22-Apr-08 6:43
Trevortni22-Apr-08 6:43 
GeneralI :heart: Microsoft Pin
Trevortni23-Apr-08 10:11
Trevortni23-Apr-08 10:11 
GeneralAccess db autonumber Pin
ziperzappper22-Apr-08 5:57
ziperzappper22-Apr-08 5:57 
GeneralRe: Access db autonumber Pin
Mycroft Holmes22-Apr-08 14:40
professionalMycroft Holmes22-Apr-08 14:40 
GeneralRe: Access db autonumber Pin
ziperzappper24-Apr-08 11:59
ziperzappper24-Apr-08 11:59 
Questionpicturebox databinding programatically Pin
JMS7622-Apr-08 5:50
JMS7622-Apr-08 5:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.