Share socket between two tasks

Good afternoon,
I am trying to send some messages through a tcp/ip socket. The problem is that I have a semistatic task and I want to send messages in this task too.
I have tried to declare the variable “socketdev” as a PERS in both programs, but I cant put a value when I declare them at the program, so the program shows an error.
Somebody knows how can I do it?
Thank you so much

I am not 100% sure I understand your question, but let me suggest that you create a 3 task that handles all the communication for the socket. Then use variables to trigger the 3 task to send and receive the sockets. You could then just have your other two task set the variable values and then set a variable that would trigger the send. Then have the 3 rd task set a variable when it has received the information.

SocketDev is a non value data type. As such, it must be VAR and not PERS. Use a different socket connection for the other task.