Forums Login/signup

Server cannot show string

+Pie Number of slices to send: Send
hi.

i recreate a server program in my pc that can read any input (string) from client(android) which is transmitted via bluetooth (kinda like bluetooth chat). The problem is my server seems cannot show string immediately after i send it from my client, it'll only appeared after i turn off the bluetooth and the connection was cut, also it won't send response string to client. already try to put pWriter.flush() to make string shows, but it doesn't works. can you tell me what's wrong with my program? thank you.

here is my program :



+Pie Number of slices to send: Send
Can you show the client code as well please and does it use flush() as well.
+Pie Number of slices to send: Send
i though it'll be different when i'm programming using android studio so i'm not using flush();. do i have to use it too? sorry, i am new to java.

here's my code in client to read and write my string:



Thanks for your help.
+Pie Number of slices to send: Send
Sorry I've never programmed for android so I can't give you a definitive answer to that but I would have thought you would have needed to call flush().
+Pie Number of slices to send: Send
I thought the problem is occurred on my server sides because i already change my client program several times but the result on server is still same. do you have any idea or some suggestions regarding my server sides?
+Pie Number of slices to send: Send
The problem with not calling flush() in the client code (assuming the android stuff works the same as standard Java) is the client is unlikely to send the string until the connection is being closed (or the buffer fills up) so the server will just sit there waiting for the message from the client.
+Pie Number of slices to send: Send
To help determine if it is a client-side problem or a server-side problem, try using a running an Android Bluetooth terminal emulator client, and see if the behaviour on the server changes.

reply
reply
This thread has been viewed 1042 times.
Similar Threads
Nokia 6600 to PC communication issue. Please help.
Bluetooth in java
Bluetooth in java
how to compile this type of code..
Bluetooth Serial Communication Failed (Bluecove)
More...

All times above are in ranch (not your local) time.
The current ranch time is
Jun 30, 2025 11:24:18.