GeeCON Prague 2014*
The moose likes Sockets and Internet Protocols and the fly likes Problem in communication bet'n vb client and java server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Problem in communication bet Watch "Problem in communication bet New topic
Author

Problem in communication bet'n vb client and java server

ravi upasi
Greenhorn

Joined: Oct 29, 2003
Posts: 1
Hi all,
The vb client is successfull in connecting to the server and also sending the data.. I am not getting any error/exception there.the server is not able to receive any data .Only after I close the vb client Application the message sent by the client is seen on the server side..

Please help me in this regards..
thanks in advance
Ravi
Yeh i will write more detail about my code..
We had first designed first the server in java.and the client also in java..As the UI for client doen'nt look nice in Java i shifted to do VB client..
I am using the Winsock control..( VB6 )
I am doing the
winsock.connect
then checking whether the socket is in the sckConnected state or not
If client socket is in the connected state
Then i am sending the data.
The server needs to receive this data(username and password)
Server authenticates the user and send back a string as Authenticcated.
The VB Client needs to receive this data so
IN Vb Client i call the winsock.GetData..
But problem is i am not seeing any message in Java server side
and no message is being sent by server to Vb Client..
But when I close the VB Application..The message on the server side is seen ie.,
the user name and password that Vb client had sent..
pls guide me in this regard
I am attaching the code also
Dim strdata As String
Dim index As Integer
Static intClick As Integer
Dim intClickNumber As Integer
Dim dblEndTime As Double
If frmclient.optconfig = False Then
MsgBox "Enter the Server Name and Port Number in Configure Tab", vbOKOnly, "HostConfigure"
frmlogin.Hide
Exit Sub
End If
If txthostid = "" Or txtpassword = "" Then
MsgBox "Enter the HostId and Password ", vbOKOnly, "HostLogin"
Exit Sub
End If
MsgBox frmclient.tcpclient.State
If frmclient.tcpclient.State <> sckConnected Then
frmclient.tcpclient.Connect
End If
' Each time the button is clicked,
' give it a unique number.
intClick = intClick + 1
intClickNumber = intClick
' Wait for ten seconds.
dblEndTime = Timer + 10#
Do While dblEndTime > Timer
' Do nothing but allow other
' applications to process
' their events.
cmdok.Enabled = False
cmdcancel.Enabled = False
DoEvents
Loop
cmdok.Enabled = True
cmdcancel.Enabled = True
MsgBox frmclient.tcpclient.State
If frmclient.tcpclient.State = sckError Then
MsgBox "Server not ready", vbOKOnly, "TCPError"
Exit Sub
End If
If frmclient.tcpclient.State <> sckConnected Then
MsgBox "Client not connected to Server", vbOKOnly, "TCPError"
Exit Sub
End If
frmclient.tcpclient.SendData ("host3" + "$" + "host3")
frmclient.tcpclient.GetData strdata
txtoutput.Text = strdata
MsgBox strdata
frmlogin.Hide
waiting for ur reply sir,
thanks
Ravi
dumukku dumukku
Greenhorn

Joined: Nov 24, 2003
Posts: 4
Originally posted by ravi upasi:
Hi all,
The vb client is successfull in connecting to the server and also sending the data.. I am not getting any error/exception there.the server is not able to receive any data .Only after I close the vb client Application the message sent by the client is seen on the server side..

Please help me in this regards..
thanks in advance
Ravi
Yeh i will write more detail about my code..
We had first designed first the server in java.and the client also in java..As the UI for client doen'nt look nice in Java i shifted to do VB client..
I am using the Winsock control..( VB6 )
I am doing the
winsock.connect
then checking whether the socket is in the sckConnected state or not
If client socket is in the connected state
Then i am sending the data.
The server needs to receive this data(username and password)
Server authenticates the user and send back a string as Authenticcated.
The VB Client needs to receive this data so
IN Vb Client i call the winsock.GetData..
But problem is i am not seeing any message in Java server side
and no message is being sent by server to Vb Client..
But when I close the VB Application..The message on the server side is seen ie.,
the user name and password that Vb client had sent..
pls guide me in this regard
I am attaching the code also
Dim strdata As String
Dim index As Integer
Static intClick As Integer
Dim intClickNumber As Integer
Dim dblEndTime As Double
If frmclient.optconfig = False Then
MsgBox "Enter the Server Name and Port Number in Configure Tab", vbOKOnly, "HostConfigure"
frmlogin.Hide
Exit Sub
End If
If txthostid = "" Or txtpassword = "" Then
MsgBox "Enter the HostId and Password ", vbOKOnly, "HostLogin"
Exit Sub
End If
MsgBox frmclient.tcpclient.State
If frmclient.tcpclient.State <> sckConnected Then
frmclient.tcpclient.Connect
End If
' Each time the button is clicked,
' give it a unique number.
intClick = intClick + 1
intClickNumber = intClick
' Wait for ten seconds.
dblEndTime = Timer + 10#
Do While dblEndTime > Timer
' Do nothing but allow other
' applications to process
' their events.
cmdok.Enabled = False
cmdcancel.Enabled = False
DoEvents
Loop
cmdok.Enabled = True
cmdcancel.Enabled = True
MsgBox frmclient.tcpclient.State
If frmclient.tcpclient.State = sckError Then
MsgBox "Server not ready", vbOKOnly, "TCPError"
Exit Sub
End If
If frmclient.tcpclient.State <> sckConnected Then
MsgBox "Client not connected to Server", vbOKOnly, "TCPError"
Exit Sub
End If
frmclient.tcpclient.SendData ("host3" + "$" + "host3")
frmclient.tcpclient.GetData strdata
txtoutput.Text = strdata
MsgBox strdata
frmlogin.Hide
waiting for ur reply sir,
thanks
Ravi
dumukku dumukku
Greenhorn

Joined: Nov 24, 2003
Posts: 4
Hi ravi,
You have to send data with vbcrlf in vb client side.
example winsock.send "message" & vbcrlf
i have one question about java server how do you handling proxy in sever side pls reply me

Originally posted by ravi upasi:
Hi all,
The vb client is successfull in connecting to the server and also sending the data.. I am not getting any error/exception there.the server is not able to receive any data .Only after I close the vb client Application the message sent by the client is seen on the server side..

Please help me in this regards..
thanks in advance
Ravi
Yeh i will write more detail about my code..
We had first designed first the server in java.and the client also in java..As the UI for client doen'nt look nice in Java i shifted to do VB client..
I am using the Winsock control..( VB6 )
I am doing the
winsock.connect
then checking whether the socket is in the sckConnected state or not
If client socket is in the connected state
Then i am sending the data.
The server needs to receive this data(username and password)
Server authenticates the user and send back a string as Authenticcated.
The VB Client needs to receive this data so
IN Vb Client i call the winsock.GetData..
But problem is i am not seeing any message in Java server side
and no message is being sent by server to Vb Client..
But when I close the VB Application..The message on the server side is seen ie.,
the user name and password that Vb client had sent..
pls guide me in this regard
I am attaching the code also
Dim strdata As String
Dim index As Integer
Static intClick As Integer
Dim intClickNumber As Integer
Dim dblEndTime As Double
If frmclient.optconfig = False Then
MsgBox "Enter the Server Name and Port Number in Configure Tab", vbOKOnly, "HostConfigure"
frmlogin.Hide
Exit Sub
End If
If txthostid = "" Or txtpassword = "" Then
MsgBox "Enter the HostId and Password ", vbOKOnly, "HostLogin"
Exit Sub
End If
MsgBox frmclient.tcpclient.State
If frmclient.tcpclient.State <> sckConnected Then
frmclient.tcpclient.Connect
End If
' Each time the button is clicked,
' give it a unique number.
intClick = intClick + 1
intClickNumber = intClick
' Wait for ten seconds.
dblEndTime = Timer + 10#
Do While dblEndTime > Timer
' Do nothing but allow other
' applications to process
' their events.
cmdok.Enabled = False
cmdcancel.Enabled = False
DoEvents
Loop
cmdok.Enabled = True
cmdcancel.Enabled = True
MsgBox frmclient.tcpclient.State
If frmclient.tcpclient.State = sckError Then
MsgBox "Server not ready", vbOKOnly, "TCPError"
Exit Sub
End If
If frmclient.tcpclient.State <> sckConnected Then
MsgBox "Client not connected to Server", vbOKOnly, "TCPError"
Exit Sub
End If
frmclient.tcpclient.SendData ("host3" + "$" + "host3")
frmclient.tcpclient.GetData strdata
txtoutput.Text = strdata
MsgBox strdata
frmlogin.Hide
waiting for ur reply sir,
thanks
Ravi
Jignesh Kakkad
Ranch Hand

Joined: Apr 09, 2004
Posts: 49
Hello 2 all,

Bt may i know JAVA server code with this VB client I am unable to read data from VB client. So if it is working with this code then do let me know..

thanx

Jignesh
ji2nesh@gmail.com


Jignesh Kakkad, Cellent Technologies Pvt, Nariman Point, Mumbai
 
GeeCON Prague 2014
 
subject: Problem in communication bet'n vb client and java server