aspose file tools*
The moose likes Sockets and Internet Protocols and the fly likes socket programming with SERVER in VB and CLient in JAVA ??? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "socket programming with SERVER in VB and CLient in JAVA ???" Watch "socket programming with SERVER in VB and CLient in JAVA ???" New topic
Author

socket programming with SERVER in VB and CLient in JAVA ???

vp pan
Greenhorn

Joined: Dec 02, 2008
Posts: 8
i am building an application for mobiles ( JAVA) which connects to the PC (SERVER)


the mobile using JAVA SOCKET PROGRAMMING connects properly then sends a string of data to the SERVER written with VB

it is recieved by the PC but the problem is that but the VB code
is not able to display that string

it shows it as blank

if i send a integer it shows BOXES in the message box

wat can i do i need the CLIENT TO BE in JAVA becoz its on mobile so i cannot use VB
Jon Parise
Ranch Hand

Joined: Jul 03, 2007
Posts: 81
It sounds to me like you just need to make your own communications protocol(not as scary as it sounds). Basically, you need a language that the client and server will share and communicate using.

You'll want to do this over TCP/IP using socket connections. Have the Server constantly listen for connections and accept them. Then simply have the client make a connection to the server.

Once connected, you need some messages that they both understand. You can encode these however you want as binary data or even just using ascii strings(they get sent as binary).

The first step is to determine what data will be passed back and forth and how. For example consider a weather application. Say the server monitored weather in the whole country and the client coudl ask for the weather in a specific locations.

You could do something like this:

Client connects
Sever accepts connection
Client sends request: GET Weather Pittsburgh,PA
Server processes the request lookign up teh weather
Client listens for a response
Server sends back information:TEMP 24, WIND SE 10MPH
Client receives data
Client closes connection
CLient updates display.

This is just a very basic pseudo code example, but that is basically how it can be done. Obviously the protocol should be much more robust.

Hope that helps,

Jon
Jon Parise
Ranch Hand

Joined: Jul 03, 2007
Posts: 81
Sorry for the double post, but I wanted to add something.

Boxes usually mean that your data is not getting encoded right. How are you building you Java packets? Could you show us the code?

Sometimes if a packet is not built correctly you will get boxes like that.
vp pan
Greenhorn

Joined: Dec 02, 2008
Posts: 8
THANKS TO ALL OF U ALL YOU

well i solved the problem like this

i converted the String to bytes
String test = new String("Hello");

and the used

out.write(b);

---------

On VB side

--------

sckm.GetData b, vbByte, bytesTotal

sData = StrConv(b, vbUnicode)


THANKS TO ALL OF YOU
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: socket programming with SERVER in VB and CLient in JAVA ???
 
Similar Threads
Java VB communication
Java VB communication
VB Socket to Java Socket
Running a client/server apllication
problem with connecting vb client to java server