Gemalto is now part of the Thales Group, find out more.

You are here

BGS2T - Setup TCP/IP connection with server. Can send data, but not receive. | Thales IoT Developer Community

DM's picture

April 26, 2015 - 2:23pm, 2808 views

I am currently trying to set up a TCP connection to a simple server. At this point I want the BGS2T module to send some data to the server and the server should then give a response.

The server is fairly simple and the Java code can be seen below. The server receives some data, capitalizes this data and sends it back.


class TCPServer
   public static void main(String argv[]) throws Exception
         String clientSentence;
         String capitalizedSentence;
         ServerSocket welcomeSocket = new ServerSocket(32789);

            Socket connectionSocket = welcomeSocket.accept();
            BufferedReader inFromClient =
               new BufferedReader(new InputStreamReader(connectionSocket.getInputStream()));
            DataOutputStream outToClient = new DataOutputStream(connectionSocket.getOutputStream());
            clientSentence = inFromClient.readLine();
            System.out.println("Received: " + clientSentence);
            capitalizedSentence = clientSentence.toUpperCase() + '\n';

The server works as expected. I have tested it using another computer (and mobile phone on mobile network).

On my router at home I set up port forwarding, so that the BGS2T can connect to the IP address of the server running on my computer.

For the BGS2T i use the following initialization:

Check RSSI and service provider:
=> AT
=> AT^SIND="eons",2            (Service provider is Danish Telenor)

Connection profile:
=> AT^SCFG="Tcp/WithURCs",on
=> AT^SICS=0,conType,GPRS0
=> AT^SICS=0,apn,"Internet"          ("Internet" is APN for Telenor)

Service profile for caller:
=> AT^SISS=1,srvType,socket
=> AT^SISS=1,conId,0
=> AT^SISS=1,address,"socktcp://{IP}:{Port}"
=> AT^SISO=1
Wait for remote server ready:
^SISW: 1,1
Write down port used on BGS2T {BGS2T_port}

Service profile for listener:
=> AT^SISS=4,srvType,socket
=> AT^SISS=4,conId,0
=> AT^SISS=4,address,"socktcp://listener:{BGS2T_port}"
=> AT^SISO=4
^SISO: 0, ""
^SISO: 1, "Socket","4","2","0","0","{module_IP}:5954","{IP}:{Port}"
^SISO: 2, ""
^SISO: 3, ""
^SISO: 4, "Socket","3","3","0","0","{module_IP}:5954",""
^SISO: 5, ""
^SISO: 6, ""
^SISO: 7, ""
^SISO: 8, ""
^SISO: 9, ""


Using AT^SISW:
^SISW: 1,5,5

^SISW: 1,2

This is what I have so far. On the server I see the "abcde" message, but I'm not receiving any ^SISR:  4, 5 URC on the BGS2T as expected (I expect to receive "ABCDE").

  1. Am I doing anything wrong in the setup of the listener? As I understood you have to set up a caller and listener service profile to make a two-way TCP connection. 
  2. Could the problem be that i do not have a public IP on Telenors network (I can buy a APN for 5 dkr.)?
  3. Could a transparent connection solve this?

I have a capture from wireshark (seen from server) that I can insert if wanted.

Best regards