Posts: 9
Threads: 1
Likes Received:
0 in 0 posts
Likes Given: 0
Joined: Jul 2025
Reputation:
0
Hello, i want to program a TCP/IP Socket to establish an ethernet communication, just to transmit some values over ethernet.
I look for some example codes or API or libraries in litdev.
Who can give me a hint ?
Posts: 654
Threads: 41
Likes Received:
482 in 334 posts
Likes Given: 256
Joined: Aug 2023
Reputation:
25
For http Web requested look at ldnetwork. For network communications look at ldserver and ldclient.
I am away from home at present without pc, but I think there are some samples for these with the extension download.
If you use sb prime then you can also search extensions.
Not sure exactly what you are after, but I think the ldserver ldclient is most likely.
Posts: 9
Threads: 1
Likes Received:
0 in 0 posts
Likes Given: 0
Joined: Jul 2025
Reputation:
0
Thanks for your help, i think LDServer and LDClient is what i need. Can you give me a link to some examples where they are used ?
Thanks
Posts: 9
Threads: 1
Likes Received:
0 in 0 posts
Likes Given: 0
Joined: Jul 2025
Reputation:
0
I am programming a program for my Pc connecting to a device that control a model railway. I think this device is the server and my PC is client. In the description of this device it is declared that it has an ethernet with a IP 192.168.2.20 and a recieve Port 15730 and a send Port 15731. Now my question : do i have to connect to both ports with :
LDClient.Connect( "192.168.2.20:15730", "False" ) and LDClient.Connect( "192.168.2.20:15731", "False" ) , or only connect to the recieve Port 15731 ?
Posts: 654
Threads: 41
Likes Received:
482 in 334 posts
Likes Given: 256
Joined: Aug 2023
Reputation:
25
Hi,
I've only used the Client/Server with both client and server being Small Basic programs, so not fully sure.
If the server is using different ports to send and receive data, then I think you may need 2 separate SB programs to connect to each.
I guess I would start by tring to send a message to 192.168.2.20:15731 in a simple SB program and check if this gets through. If this works it is a good start.
To receive messages use the LDClient.ServerMessage event and property LDClient.LastServerMessage, but I think this will have to be a separate SB program connected to 192.168.2.20:15730.
If these work independently, then I would think that one of the 2 SB programs would be the master and the other would be a slave that is controlled by the master, perhaps through a common file.
Posts: 9
Threads: 1
Likes Received:
0 in 0 posts
Likes Given: 0
Joined: Jul 2025
Reputation:
0
thanks for information, the device i am connected with i can not modify only i can put in an other ip adress , nothing more. And on my pc i have only one program with i want to send and recieve messages. so i thing i have to connect to both ports if i understand you correctley.
Posts: 654
Threads: 41
Likes Received:
482 in 334 posts
Likes Given: 256
Joined: Aug 2023
Reputation:
25
Yes, but I am only guessing to some extent. I would test the sending and receiving separately on very small test SB programs using the different ports as I suggested.
Once these both work independently, we can consider how to use both together - I suspect this will have to be 2 SB programs, but I can help suggest ways to run them together when you get to that point.
Posts: 9
Threads: 1
Likes Received:
0 in 0 posts
Likes Given: 0
Joined: Jul 2025
Reputation:
0
can you tell me if this syntax is correct ?
If LDClient.CheckServer( "192.168.0.96:15731" ) = "AVAILABLE" THEN
LDClient.Connect( "192.168.0.96:15731", "TRUE" )
CS_Recieveport_connected = 1
EndIf