This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Sockets and Internet Protocols and the fly likes help with socket programming ??? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "help with socket programming ???" Watch "help with socket programming ???" New topic

help with socket programming ???

vp pan

Joined: Dec 02, 2008
Posts: 8
i am doing a project on GPRS communication

my project requires sending a string of data from PC to a mobile

the MOBILE service provider i use uses a WAP GATEWAY so i cannot connect to it

because the IP address of the mobile is hidden behind the gateway

so i changed it to that the mobile will connect to the PC
i am able to establish the connection and the string of data is going to PC
but the response i.e " data recieved"
should be sent but how do i send the repsone

please tell me because i do not know the IP ADDRESS OF THE MOBILE ???

please help me with code if you can because i am new to J2ME or please explain me the logic atleast
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199


Welcome to JavaRanch!

Presumably you've created a ServerSocket on the PC, right? You call accept(), and when the mobile connects you get a Socket. The Socket is a two-way connection endpoint: you can read from it as well as write to it. Likewise, the Socket that the mobile is sending on, it should also be able to read from. You don't close the connection until everybody is through.

You use Socket.getInputStream() to get a stream you read from; you use Socket.getOutputStream() to get one that you write to.

[Jess in Action][AskingGoodQuestions]
vp pan

Joined: Dec 02, 2008
Posts: 8
thanks for the reply
will the GATEWAY part will be handled automatically by the JVM

is this what you mean to say

that if the mobile establishes ( on the mobile)

all imports

-------------- (on the PC)

I agree. Here's the link:
subject: help with socket programming ???
It's not a secret anymore!