I have been written chat program code for wired network.
I want to write the chat code in java for wireless network.I googled it for this.But i can't found that.So please guide me to write the chat code in java for wireless networks in java.
Thanks in advance.
The reason why do didn't find anything on Google is probably because it's no different from working with a wired network. The type of medium used for network communication lies on a lower level than your Java application is suppose to care about.
Creating a chat program on a wireless network is not different from creating a chat program on any network. Normaly, you don't have to handle layers that deep in the network stack.
So basically, what you are looking for is infos about how to create a chat program in Java. Your question is a bit vague. Do you want to create your own chat protocol or implement an existing protocole, like XMPP (the protocol behind Jabber and Google Talk)? The first possibility is a bit complicated and kind of pointless outside an academic context, so I go with the second. You can look at libraries letting you use XMPP in Java, like Smack:
http://www.igniterealtime.org/projects/smack/index.jsp
Hope it helps...
Related
I'm trying to develop a memo app for my Gear S2 that shows my memo written on my phone. Though, I don't know how to send the text to my smartwatch. Doing so via Bluetooth might be the solution. The question is, how can I program it to use it? Thanks for the help.
Edit: Could you give me the code in java or in any other type of language? Beacuse i'm having trouble with that.
You can transfer data between Tizen(Gear) and Android(Mobile) via SAP(Samsung Accessary Protocol). SAP supports both Bluetooth and WiFi.
You can learn about SAP in below site, Samsung Developer official site.
http://developer.samsung.com/gear/develop/creating-your-first-app/native-companion/setup-sdk
You can also get a simple useful sample application to adopt quickply to your project.
http://developer.samsung.com/gear/develop/samples/companion
Good luck to you.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
After searching a lot on the web I can not find obvious answer for my question.
I'm trying to send some messages using wifi between my PC and my android phone. My PC runs a java program and in this situation I have only two devices i.e a PC and an android phone. I want to make connection between these two devices without using modems or access-points. I have very little experience about networking/communication and related stuff but I already know there are two kind of communication: client-server and P2P. I have no idea which one to use in this situation.
Usually code examples or tutorials are very good ways to learn something but any idea about how can I start will also be helpful :)
thanks a lot,Soroush
Since you're not very experienced in this area I'm going to suggest that you create a Client-Server solution.
The next step is to establish which end-point is going to act as the server. In most cases a mobile device would act as a client and your PC as the server, however it works both ways.
From here you should be able to find plenty of tutorials describing how to implement this kind of solution (I've done this many times myself when I first learned this).
Examples:
What is a socket? - A basic walkthrough of network communication in Java, with code examples.
Java - Networking - Another fairly straight forward tutorial.
Android Socket Example - A more Androidy tutorial, much the same as the others.
Hope this gets you pointing in the right direction!
I think you are looking for Wi-Fi Peer-to-Peer. You can make the Android act as a Hot Spot / Access Point and then have the PC join the WiFi LAN. No modem is required. The example shows how to discover IP addresses of peers. After that the two devices communicate using sockets and stuff... Also look at the two sample apps included in your Android SDK at ...\samples\android-19\legacy\WiFiDirect*
I am talking about components that can be externally attached to a computer system via some port or other means, not about any of the component that is part of or peripheral of computer itself.
Actually, working on a college project for controlling traffic lights and boom barrier at railway crossing. I've got knowledge in Java but I do not know how can I get the traffic lights and boom barrier working on events in a Swing based application?
One thing is I can create a electronic circuit which can read the small output voltages at computer ports such as a USB port and used them as a trigger for controlling the devices. But how can I generate that small voltages using Java application?
Is JavaPOS can be the solution? or something else?
Any ideas? Suggestions? Articles? Samples?
I'd work backwards from the external device. Answer this 1st: What's the easiest way to communicate with it? If you say USB, ok, use usb. Then ask, what's the easiest way to interface with USB. Then build in whatever language you find to be easiest this USB interface. Finally, call from your Java swing application to this USB-wrapping application... it could be that simple invoke the app using something like ProcessBuilder.
In other words, I think it might be a mistake to solve the problem of interfacing to something like this device with Java, unless it's easy to do so directly.
Have you considered communicating with these external devices by sending digital signals to a serial port using Java? It's then a simple matter of either using those digital signals directly, or using an Analog-to-digital converter to get a voltage of desirable magnitude.
Same for input from the serial port. The RXTX library can help you do this (communicate with the serial port).
On the other hand, if you have access to MATLAB, then this sort of stuff is a piece of cake. Take a look at the Data Acquisition Toolbox and Instrument Control Toolbox.
I think your looking at this the wrong way. Most lights are them selves computer controlled. The lights are running on a computer system. If your project is to write this start to end, then you need to write a loaded to the light controller that does many things, one controls light color and direction, also allow connections via an out side computer. This connection could be USB, Ethernet ext. Now write a program facilitating connecting to the lights and pass commands to the light controller.
this is the first time I´m posting something here.
I´m working on a Project where I want to control the Windows Media Player through different Input Modalities (like Multitouch, a 3D Mouse...). At the moment I´m trying to find a way to control the Windows Media Player remotely.
Write now I´m stuck on controlling the Player through a Java Program using the Jacob Library. It seems to be connecting to the WMP, but it does not execute my controls (Play in this case).
Does anybody have any experience with controlling the WMP remotely? My preferred language would be Java, do you know about an alternative/better way than using Jacob for the COM Bridge? Or do you know about a different approach, with which it would be easier to control the WMP?
I have to keep in mind, that i will need to be able to read out the input from the different devices and make the device work with the control of the WMP.
I hope somebody can help me!
thank you so much in advance!
You will probably need to take a look at the Windows Media Player SDK and in order to controll it remotely you may have to implement a small client server application which does the remote control job for you.
I want to make a browser-based game in Java that will depend heavily on networking. I wanted to make it so that one player in the game hosts it and the rest in that game play with him, but with Java that requires signing the applet and port forwarding and all kinds of stuff.
So my question is, What would be the best way to design a server system for my game without
spending tons of money on 24/7 server hosting? If I didn't explain parts of my question well enough, please tell me and I will reword it. Thanks in advance!
A Java Applet is not a strictly 'browser-based' game because it will require the JRE.
If you're intent on Java, you might look in the Google Web Toolkit. It allows you to write client and server code entirely in Java and compile it to JavaScript. I'd caution that it has a steep learning curve especially if you aren't familiar with servlets and client-server programming in general.
Here's an example game made in GWT:
http://allen-sauer.com/com.allen_sauer.gwt.game.hornetblast.HornetBlast/HornetBlast.html
As for server hosting, if you don't want to purchase/maintain your own server, you might consider a cloud provider such as Amazon Elastic Compute Cloud (EC2). A single instance will run you $40-$70 per month.
My first guess would be to make the game peer-2-peer , so that a server is not involved except for downloading the game. When the game starts, have it prompt for the IP addresses of your friends. This could be sortof a password into the game to get it started.
Some thoughts/ideas:
http://java.sun.com/developer/technicalArticles/peer/
http://code.google.com/p/jsmpp/
http://www.ibm.com/developerworks/java/library/j-jxta2/