I am just going through the new features of GCM Cloud connection server. On client side this seems fairly easy using the google play services, as described in https://developer.android.com/google/gcm/ccs.html, however for the server side it says:
GCM Cloud Connection Server (CCS) is an XMPP endpoint, running on
http://gcm.googleapis.com port 5235.
CCS requires a Transport Layer Security (TLS) connection. That means
the XMPP client must initiate a TLS connection. For example in smack,
you would call setSocketFactory(SSLSocketFactory), similar to “old
style SSL” XMPP connections and https.
CCS requires a SASL PLAIN authentication mechanism using
#gcm.googleapis.com (GCM sender ID) and the API
key as the password, where the sender ID and API key are the same as
described in Getting Started.
Does that mean I manually have to open a port and parse xml/json or is there some kind of Java API that I can use to implement the server side?
For the GCM Server there is a library, the javadoc is at http://developer.android.com/reference/com/google/android/gcm/server/package-summary.html
There is a demo server app Google has written here at http://developer.android.com/google/gcm/server.html
As I understand you can choose whether you want to use the XMPP service or the old HTTP service. Not sure what the advantage is.
You can use Smack library to work with XMPP in Java.
And here you can find an example code that sends notifications using GCM CCS.
Related
I have server application which runs on local host and the client also runs on local host.
As of now I am using java.net.serversocket and any application which has the ip and port detail of server can listen to the port.
My requirement is to secure the ports or secure the communication between the server and client application such that only my application client (authorised) one can listen to the ports or connect to server application. The data sent to and from client and server also has to be secured.
Apologies if naming conventions are not correct. I have been searching for solution and couldn't get anything for this, all I got is how to connect and make application communicate using socket programming , but no where I got the answer as how to secure the communication.
What you need here is some sort of authentication method to authorise only your client to communicate with the server. If you are using an existing communication protocol then it might have a specification for authentication already. If you are using your own protocol then you'll have come up with your own design for authentication.
It could be as simple as the server issuing some sort of request for authentication to the client. The client would then have to provide a satisfactory response (eg a user/password) otherwise the server would close the connection.
I would recommend taking a look at how some other protocols (eg HTTP) handle authentication to get some insight and also understand potential pitfalls.
Respected All! I'm working on a project where we are developing an SMS-based disaster management system.
we have to send a request to an SMSC server over SMPP protocol to broadcast an SMS to all of its Subscribers. The cellular company has provided us with the IP/port, username and pasword to connect to their SMSC server.
I'm a bit confused on what steps should be followed to connect to their SMSC server?
kindly someone answer my following questions:
1) How to connect to the SMSC server over SMPP protocol?
2) Do we have to create our own SMPP server to send request to the SMSC server?
3) If the answer to Question# 2 is yes, then how to send request to SMSC server from SMPP server?
Any help will be appreciated! Thanks in advance!
"If your provider uses the HTTP Protocol to have sms sent over to them then you would need to use HTTP POST/GET method. On the other hand if your provider uses the SMPP (Short Message Peer to Peer) Protocol you would have to use the same to connect to them."-Source
So, it looks like the provider is using SMPP protocol. That's means you have to set up a SMSC connection. You would need to use a Java API for this, download these libraries in your project. There should be documentation on how to set things up in the Java documentation with the download. gl
Another option is the Open Source Mobicents SMSC server, which supports SMPP, SIP and SS7/SIGTRAN interfaces, as well as HTTP REST APIs via Restcomm.
In fact you may want to consider promptly building the SMS handling logic with the Restcomm Visual Designer and use the External Service feature to integrate with the rest of your business logic.
https://code.google.com/p/smscgateway/
http://www.restcomm.com/
need help regarding USSD Gateway.
I have to develop an app, which will directly connect to telco's USSD Gateway and listen messages on specific allocated short code number e.g. 444.
Actually, when a customer issue *444# USSD from his phone, request arrived at teleco's USSD Gateway, and it should forward to my app, which should be connected and listening mode. It process the request and give back the response. FYI, I have credentials from telco to connect with their USSD Gateway.
Anybody, can give me idea/help/concept how I can achieve this, in Java.
This is taking my head and I will be bungle of thankful for the person who help me anyway.
You need to know how their ussd gateway supports communication .. i.e if it is smpp then you need smpp protocol implementation to connect to their gateway. process the request and give response back.. just like sms.
[Solution]
Yes, we received USSDC Gateway specification, and they are totally different than SMPP specification.
So, we just developed TCP based program which assemble the packet in desired format and sent them to the USSDC gateway, the response is parsed as USSDC docs said.
That's how we make the communication possible.
We used Apache Mina for optimal & Java NIO for socket communication, threads & polling and stuff like that. Over Apache Mina, we just send / receive our PDU/Packets.
I had set up a system that had a Java program running on a server and a Java applet embedded in a page on a client's browser and the two communicating via Java sockets. I'm wondering if I can switch over from a Java applet to just HTML5 and javascript, using a WebSocket on the client side for communication with the Java socket on the server.
Is there a simple way to make a WebSocket communicate with a Java Socket?
Is there a simple way to make a WebSocket communicate with a Java Socket?
From what I understand, WebSocket works by the client side opening a port 80 connect to the server side, and sending a variant HTTP 1.1 request to the server to negotiate a WebSocket connection. If the server recognizes this, it will send a suitable response, and then allow the still open TCP connection to be used for full-duplex client-server interactions.
It looks like it would be possible to quickly put together a server-side that just understood WebSocket negotation and not full HTTP. However, I think you are better off looking at existing WebSocket implementations, including those embedded in HTTP servers / protocol stacks.
This Wikipedia page compares a number of WebSocket implementations, and should help you in deciding which server-side implementation to use.
But to directly answer your literal question, a WebSocket client can only connect to a WebSocket-aware server; i.e. that one that can perform the initial negotiation. (On the client side, you could implement starting from a bare Socket, but you would need to implement all of the "HTTP stuff" on top of that ... for the setup phase.)
Nope, you cannot communicate using regular sockets with client WebSockets.
WebSockets are special HTTP requests, with an upgrade in the HTTP Header, and a standard protocol to establish a connection (see the official RFC doc).
I want to send an email without using SMTP protocol. Is that possible to implement using Java? Since, my remote machine does not have access to google, yahoo and other accounts. and even my office mail can not be configured using SMTP server due to some security issues. Is any other way to send an email from remote machine.
The JavaMail section at java.sun.com lists many third party products that plugin to the JavaMail API. Hopefully one of those will fit your needs but I can't be more specific because you don't say what non-SMTP sending options you have open to you.
You could setup Your own SMTP server on remote machine, IMHO, it is better than incorporate it into program directly.
I want to send an email without using
SMTP protocol. Is that possible to
implement using Java?
With Java you can implement any Layer-5 network protocol.
ALL mail servers using SMTP to receive messages. At any time you have to connect with SMTP to the destination mail server.
If you cannot get out from local network to the Internet with some services you will need a proxy or network tunnel to connect the destination.