i created my own chat application using j2me polish (netbeans IDE) i designed a chat screen using framed form and added a textfield with direct input property, and when sending '&' symbol, the connection closes immediately....
any ideas please..
btw i am using openfire 3.6.4
Look for an error message in the XML stream from the server. If the server is closing the connection it should give you an error message for why. The most likely reason is that you're not escaping XML reserved characters ('&' is a reserved character) in the message text and the server detects the improperly formatted XML and closes the connection.
Related
I have followed a tutorial on Python Sockets and trying to modify the client side to send updated data but in vain. The source code of the tutorial can be found here. The problem is I am not able to understand how to send updated message with Python selectors after registering the connection. The example I am trying to modify is:
Server works fine.
Client Here I want to send data continously at runtime.
Here in the example two messages are sent from the client side but they are defined at time of registering the connection but what I want to do is to send updated data at runtime.
I have tried to modify the object by using modify method from the selectors library but that didn't worked.
One idea I am having is to trigger a write event from client side after updating the message but how to do so I am not able to find also after spending quite some time.
Any ideas on how to send updated messages at runtime using selectors will highly be appreciated.
Edit 01
From server and client side this and this line needs to be commented out to prevent connection close after first message
I'm doing some very simple TCP socket programming right now and I have a small problem I can't seem to find the answer to. Basically, what I'm building is a server program and a client program that allow the client to request a file from the server and the server will send it.
My problem is that if the client requests a file that the server doesn't have I need to send an error message back to the client. Is there a flag that I can set to do this? I can't just send a string containing an error message because it is possible that that message could appear in a file transfer at some point and trigger an incorrect response.
I have looked through the MAN pages and some other resources but I couldn't seem to figure it out. I'm working in a Linux environment.
Thank you!
See comments on my original post from kaylum and Remy Lebeau for the solution.
this is my first post here so I hope I do well.
So, for a school project I'm handling our game's networking and we have chosen to create a multiplayer fighting game where users are able to use their phones as controllers. Originally, we were going to use phone mobile browsers and so I had some crazy Websocket server, TCP server combination going on.
Since then, we have decided to use a Unity app on the phone instead which has removed the need for the Websocket server. Before I explain the steps, these are two Github gists of the relevant code snippets that you can open in other tabs in order for this to be a bit easier to follow:
NodeJS TCP Server: https://gist.github.com/JesseLeitch/dce3f51eea893ea5872c
Unity TCP Client: https://gist.github.com/JesseLeitch/59212d34a6fad41a2efc
Now, my problem:
I will walk through the process here:
1) I start up my NodeJS TCP server on my laptop.
2) I start up a Unity game, receiving a message from the server that it has connected.
3) My team mate starts up a Unity "game"(it's our controller) on his laptop that connects to the server with a successful connection message once again from the server.
4) My friend presses a button on the controller.
5) The button sends a message to the server. For example, "Jump".
6) Here is where my problem arises. What should happen is the server then sends the message down to the game, the message is processed within the OpenStream function and then it is passed off to a movement script. This is not happening. Nothing is being read in the game and I do not know why.
I know that the writing function is working fine because the console.log on line 14 is outputting properly with his command. What I am unsure of is why the c.write(d) is not seemingly working properly - especially because this worked previously when I was using our previous Game <-> TCP <-> WS <-> Mobile browser set-up.
Any help people can offer is greatly appreciated as I'm stumped and I haven't seemed to find anything relevant in my searching because the server seems to communicate fine except for this issue.
Thanks!
~Camel
I try to make connection between Leap Motion and mobile devices in Unity3D, via node.js.
Here are two examples I found online using node.js, this and this.
Now, I have successfully receive data from Leap Motion in this procedure:
Receiving JSON-formatted messages from "localhost:6437" in node.js
Parsing and Writing received data on another port (I use "localhost:8000") in node.js
Reading stream from port: 8000 in Unity3D
However, I wonder if it's possible to receive data DIRECTLY from "localhost:6437"? then maybe node.js is not needed.
I have tried to write in C# using TcpClient, but when I check "NetworkStream.DataAvailable", it returns false.
Thanks for your help.
For that you would need a WebSocket client, not a TCP client.
I want to a Java ME application that transfers any SMS received to a PC using bluetooth. The PC can then direct the Java ME application via bluetooth to send a response SMS. Is there library available for this architecture or I have to design it myself?
Is this approach correct or a better one exists? I want to use bluetooth as then I will not have dependency on the cable.
You'll need to create this yourself, however you'll find that you can't do what you want with J2ME.
J2ME can't access any old SMS that the handset receives, only ones sent to a specific port upon which the MIDlet is listening. So to get all the other SMSes, create a bluetooth serial/dial-up connection to your handset in the way I've described in this answer.
Create a PC client which repeatedly issues AT+CGML commands (as described in the AT command set document linked to in the answer above), to see when an SMS has been received. Use AT+CGMR to read and parse the message text. Then use AT+CGMS to sent a response. This can all be done over bluetooth.
It's better to use the serial connection to send a response, because a MIDlet cannot usually be triggered to open based on incoming bluetooth data.
Hope this helps.
You may have already achieved your task, anyway for the reference I think it is much better if you try using Gammu . I'm using it for the same task (Send / receive SMS through PC ) with a simple bat file I have written, works like a charm.
Anyway you don't need any J2me program for this.
Wammu takes care of making the connection to phone and sending AT commands.