# Socket Communication

**URL:** https://tech-community.robotics.abb.com/t/socket-communication/5619
**Category:** RobotStudio
**Created:** [July 15, 2013, 10:49am UTC](https://tech-community.robotics.abb.com/t/socket-communication/5619 "2013-07-15T10:49:24Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![Dante1990](https://avatars.discourse-cdn.com/v4/letter/d/ccd318/32.png) [@Dante1990](https://tech-community.robotics.abb.com/u/Dante1990)
#### Post date: [July 15, 2013, 10:49am UTC](https://tech-community.robotics.abb.com/t/socket-communication/5619/1 "2013-07-15T10:49:24Z")

</div>

Hi,

i try to connect robotstudio with another pc. I think i have to use socket communication.

VAR socketdev client\_socket;

VAR string receive\_string;

PROC client\_messaging()

…

! Create and connect the socket in error handlers

SocketSend client\_socket \Str := “Hello server”;

SocketReceive client\_socket \Str := receive\_string;

…

SocketClose client\_socket;

ERROR

IF ERRNO=ERR\_SOCK\_TIMEOUT THEN

RETRY;

ELSEIF ERRNO=ERR\_SOCK\_CLOSED THEN

client\_recover;

RETRY;

ELSE

! No error recovery handling

ENDIF

ENDPROC

PROC client\_recover()

SocketClose client\_socket;

SocketCreate client\_socket;

SocketConnect client\_socket, “192.168.0.2”, 1025;

ERROR

IF ERRNO=ERR\_SOCK\_TIMEOUT THEN

RETRY;

ELSEIF ERRNO=ERR\_SOCK\_CLOSED THEN

RETURN;

ELSE

! No error recovery handling

ENDIF

ENDPROC

i read in a manaul, that i need pc interface, but where or who can i see, if my pc has pc inter face?

best regards

---

<div class="post-metadata">

### Author: ![SjoLi](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/sjoli/32/3340_2.png) [@SjoLi](https://tech-community.robotics.abb.com/u/SjoLi)
#### Post date: [July 15, 2013, 11:19am UTC](https://tech-community.robotics.abb.com/t/socket-communication/5619/2 "2013-07-15T11:19:49Z")

</div>

PC interface is an option in yourcontroller not on a pc

You can connect to the controller via the serviceport and have all funtionality.

If you want to be able to connect to the robot via a network the robotcontroller needs to have the option PC interface.  
Without this you are only able to get files from/to the controller via an FTP-program from a network location.

---

<div class="post-metadata">

### Author: ![kioog](https://avatars.discourse-cdn.com/v4/letter/k/e47c2d/32.png) [@kioog](https://tech-community.robotics.abb.com/u/kioog)
#### Post date: [July 15, 2013, 11:20am UTC](https://tech-community.robotics.abb.com/t/socket-communication/5619/3 "2013-07-15T11:20:37Z")

</div>

hello,

if you want to use pc interface it is your ROBOT that needs the option PC interface

make a backup of your robot and look in the directory BACKINFO for the file backinfo.txt (this is for IRC5 robot)

there you can see all the options installed in your robot, i.e. 616-1 PC Interface

Or go on your main screen ABB to “system info” and look for “System properties/Control module/options”

BR

Peter

---

<div class="post-metadata">

### Author: ![Dante1990](https://avatars.discourse-cdn.com/v4/letter/d/ccd318/32.png) [@Dante1990](https://tech-community.robotics.abb.com/u/Dante1990)
#### Post date: [July 15, 2013, 3:17pm UTC](https://tech-community.robotics.abb.com/t/socket-communication/5619/4 "2013-07-15T15:17:23Z")

</div>

thanks for the answers.  
I try to built a socket between Robotstudio and Visual basic, is that possible.

I have in my Rapid task a program error ?

Module Socket

VAR socketdev socket1;  
VAR socketstatus state;

PROC main ( )

SocketCreate socket1;  
SocketConnect socket1, “192.168.0.1”, 1025;  
!Communication  
SocketSend socket1 Str:=received\_string;  
state := SocketGetStatus( socket1 );

Endproc

ENDMODULE

---

<div class="post-metadata">

### Author: ![AlexK](https://avatars.discourse-cdn.com/v4/letter/a/91b2a8/32.png) [@AlexK](https://tech-community.robotics.abb.com/u/AlexK)
#### Post date: [August 6, 2013, 5:35am UTC](https://tech-community.robotics.abb.com/t/socket-communication/5619/5 "2013-08-06T05:35:01Z")

</div>

Please post the error message you get? For Socket commands you need to have the PC Interface option.

---

<div class="post-metadata">

### Author: ![Dante1990](https://avatars.discourse-cdn.com/v4/letter/d/ccd318/32.png) [@Dante1990](https://tech-community.robotics.abb.com/u/Dante1990)
#### Post date: [August 27, 2013, 2:49pm UTC](https://tech-community.robotics.abb.com/t/socket-communication/5619/6 "2013-08-27T14:49:57Z")

</div>

hi

i dont have pc interface, but i have to use opc for the communication.  
i know for opc, first i hve to programme with CoDeSys and after that i have to create a smart component (opc component),but how i can connect robotstudio with visual basic ?

best regards

---

<div class="post-metadata">

### Author: ![John\_Wiberg](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/john_wiberg/32/1485_2.png) [@John\_Wiberg](https://tech-community.robotics.abb.com/u/John_Wiberg)
#### Post date: [September 3, 2013, 4:43pm UTC](https://tech-community.robotics.abb.com/t/socket-communication/5619/7 "2013-09-03T16:43:26Z")

</div>

There seems to be a lot of confusion here. I think it would be more helpful if you try to explain what you are trying to achieve and get help on achieving that, instead of trying to get technical help on something which you might not need to achieve your goal anyway.

So is this for simulation purposes only or is there a real robot cell involved?

If it is a real robot cell and you need to use opc communication from some other device (PLC?) to communicate with your controller - then RobotStudio isn’t involved at all. Instead what you need is to have a PC with IRC5 OPC Server installed, then configure that with the controller, then use whatever OPC client/server interface your device have to connect it to the IRC5 OPC Server output.

If this is for simulation only then you can have Visual Basic .NET code both in a Smart Component with Code Behind, or as a RobotStudio SDK - addin. If so check out the [Developer Center](http://developercenter.robotstudio.com). However that would have nothing to do with the OPC smart component since you wouldn’t be able to edit it’s code.

Now the socket messaging would only be useful if you are running communication between two rapid tasks, or if you are running communication from the robot controller using RAPID to a PC with a PCSDK application listening. If so RobotStudio wouldn’t be involved.

So please focus instead on explaining what you need to achieve.

---

<div class="post-metadata">

### Author: ![Dante1990](https://avatars.discourse-cdn.com/v4/letter/d/ccd318/32.png) [@Dante1990](https://tech-community.robotics.abb.com/u/Dante1990)
#### Post date: [September 3, 2013, 6:24pm UTC](https://tech-community.robotics.abb.com/t/socket-communication/5619/8 "2013-09-03T18:24:36Z")

</div>

hi

i have to create a communication between robotstudio, the real robotor and visual basic.  
the programme of visual basic give robot studio instructions, for example leave path A. after that robot studio have to give the instructions to the real cell. Is it possible to connect them.

best regards

---

<div class="post-metadata">

### Author: ![John\_Wiberg](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/john_wiberg/32/1485_2.png) [@John\_Wiberg](https://tech-community.robotics.abb.com/u/John_Wiberg)
#### Post date: [September 4, 2013, 6:37am UTC](https://tech-community.robotics.abb.com/t/socket-communication/5619/9 "2013-09-04T06:37:54Z")

</div>

Ah, another student then?

Now why do you want to include RobotStudio?

If you need to make a Visual Basic app that communicate with the real robot, it is much easier and better to have that communication go directly and skip RobotStudio entirely.

You do that by creating a PC SDK application, which you can start reading about that over in [the Developer Center](http://developercenter.robotstudio.com/DevCenter.aspx?DevCenter=RobotCommunication), but you should try out the coding part [preferably by reading this chapter](http://developercenter.robotstudio.com:80/Index.aspx?DevCenter=RobotCommunication&OpenDocument&Url=../RobotCommunicationAppManual/doc20.html&OptTitle=Introduction).

I’ve created samples using C# which you can find by searching this forum, attached is one with a read/write RAPID variable, study it to see what you need to do in VB.

---

<div class="post-metadata">

### Author: ![Dante1990](https://avatars.discourse-cdn.com/v4/letter/d/ccd318/32.png) [@Dante1990](https://tech-community.robotics.abb.com/u/Dante1990)
#### Post date: [September 5, 2013, 3:38pm UTC](https://tech-community.robotics.abb.com/t/socket-communication/5619/10 "2013-09-05T15:38:18Z")

</div>

Hi

John thanks for the answer. I have to create a PC SDK Application, but where can i find the declarations for Visual Basic? Is there a Handbook of abb to this topic. In the zip are many data, which i have to install ? Another Student have to Programm Visual Basic, i have to Programme robot Studio.

Best regards

Dante

---

<div class="post-metadata">

### Author: ![Dante1990](https://avatars.discourse-cdn.com/v4/letter/d/ccd318/32.png) [@Dante1990](https://tech-community.robotics.abb.com/u/Dante1990)
#### Post date: [September 13, 2013, 1:27pm UTC](https://tech-community.robotics.abb.com/t/socket-communication/5619/11 "2013-09-13T13:27:37Z")

</div>

hi  
i read in a chapter, that i need for the real controller the following software components must be installed to develop, test and debug  
using a real robot controller:  
• ABB RobotStudio (Complete or Custom - with RobotStudio and PC SDK  
selected)  
• Microsoft Visual Studio 2005 Express or better, or, Microsoft Visual Studio  
2008 Express or better.  
• Controller option PC Interface  
• Network connection between PC and robot controller

the problem is i dont have pc interface, which other communication can i use without pc interface

---

<div class="post-metadata">

### Author: ![g327igor](https://avatars.discourse-cdn.com/v4/letter/g/dfb087/32.png) [@g327igor](https://tech-community.robotics.abb.com/u/g327igor)
#### Post date: [December 18, 2020, 11:07am UTC](https://tech-community.robotics.abb.com/t/socket-communication/5619/12 "2020-12-18T11:07:53Z")

</div>

Sorry, can somebody explain

1. What means “myString”  
RapidData rd = \_controller.Rapid.GetRapidData(“T\_ROB1”, “myModule”, “ **_myString_** ”);

2. what I should put inside the Textbox for writing RAPIDA ?  
rapidString.FillFromString( **_textBoxString.Text_** );

I need just an alive example.
