• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
vp pan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic