• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

where to set data received from wifi hotspot server

 
NeelNisha Singh
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello JavaRanch,

Here Scenario is I'm able to establish communication with WiFi Hotspot server with my android client application,if I'm sending data to server it's getting received by server,
But server sent data not showing inside the text(txtrecv)I've tried to set received data from server inside the method onProgressUpdate()

Here is the code what I'm have tried,


1.


2.


3.xml file

Please give some idea or correct me ,Thanks in Advance.
ScreenTest.PNG
[Thumbnail for ScreenTest.PNG]
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Make sure you're not running into this problem: Don't println to a Socket (no, it's not Mac-specific). Using println and readLine would trigger it.
 
NeelNisha Singh
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ulf,
Thanks for your reply,I'm not getting what exactly I need to do,I'm new to android technology,

Problem is server sent data or message i'm getting into
in = new BufferedReader(new InputStreamReader(socket.getInputStream()));



Have tried to set received data like this


@Override
protected void onProgressUpdate(String... values) {
super.onProgressUpdate(values);

StringBuilder sb = new StringBuilder();

for (int i = 0; i < values.length; i++) {
sb.append(values[i]);

}

txtRecMsg.setText(sb);
sb = null;
}

But txtRecMsg is still blank
Please Help
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A sufficient solution would be not to use Readers and Writers with sockets.

There could be other problems, though - I have not looked through the entire code.
 
NeelNisha Singh
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply

I have tried if I'm saving content in some text file and then if sending to android application client app,then it received content/data and shows also in txtRecv,
But,why not in normal case its showing data
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In that case, start by investigating what is different between both scenarios.
 
NeelNisha Singh
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have tried alot from yesterday and thought may be data was not trim so used

but still while receiving at android client inside onprogressupdate method not getting data inside txtRecv



Please help


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic