Smoke_Eater Posted December 27, 2017 Posted December 27, 2017 Hi fellow builders/programmers, The issue: There is no response to imports (A-10c sim, unpaused, DCS v1.5.8.12667). My test involves switching the battery switch on or off by sedning a UDP message. Exports work fine. My setup: I'm sending/receiving to DCS-BIOS v0.7.1 using UDP from a VisualBasic-6 program (don't laugh) running on another computer. The DCS-BIOS export works well, the VB6 program reads and parses the data, and displays a few switch states and the CDU text correctly as a test. The VB6 program listens on port 7777, and sends to 192.168.1.77:7778. (IP of the PC running DCS) The VB6 program sends a UDP message when I click a control button, but there is no response in the simulator. The message sent is "EPP_BATTERY_PWR 1\n". Here is what I've tried: A simple UDP test program, running on the same PC as DCS, receives and displays incoming data on port 7778. The UDP test program receives the battery message correctly. So I'm assuming the ports and programs are not blocked by firewalls, and IP addresses are correct. Using Resource Monitor, I've confirmed DCS.exe is receiving the messages, and VB6 and DCS are fully unblocked. I've run the VB6 program on the same PC as DCS, set IP to 127.0.0.1 (and changed the IP in BIOSConfig.lua to match). VB6 will still receive the exports fine, but imports still don't work. The dcs-bios.log is empty. The dcs.log shows no related errors. This is my BIOSConfig.lua file: BIOS.protocol_io.connections = { -- BIOS.protocol_io.DefaultMulticastSender:create(), -- BIOS.protocol_io.TCPServer:create(), BIOS.protocol_io.UDPSender:create({ port = 7777, host = "127.0.0.1" }), BIOS.protocol_io.UDPListener:create({ port = 7778 }) } Have I made a mistake with the syntax of the message?
FSFIan Posted December 28, 2017 Posted December 28, 2017 Try "EPP_BATTERY_PWR 1" & vbLf I can't remember if VB 6 supports escape sequences in string literals, and from a quick Google search it looks like it doesn't. And thanks for the trip down memory lane, the IntelliSense inside the VB editor of MS Office encouraged a lot of trial and error and I eventually learned how to program. Visual Basic was the first "real" programming language I got exposed to (I won't count batch files under MS-DOS 6.22, as you had to call out to external programs for simple things like text input and calculations). Somewhere I still have a VB 6.0 CD lying around. Does it still work under Windows 10? DCS-BIOS | How to export CMSP, RWR, etc. through MonitorSetup.lua
Smoke_Eater Posted December 28, 2017 Author Posted December 28, 2017 (edited) Thanks for the quick response Ian. No luck with your suggested change. I also tried: "EPP_BATTERY_PWR 1" & chr$(10) "EPP_BATTERY_PWR 1" & vbnewline "EPP_BATTERY_PWR 1" & chr$(13) "EPP_BATTERY_PWR 1" & chr$(13) & chr$(10) I wish to know the actual byte values that Socat sends to dcs-bios in other people's setup, even though I'm not using it. Might be help full. I'm running Windos7,64bit and VB6 runs fine. I find VB6 very easy and quick to bash out test programs. I've also interfaced many hardware projects with VB6. I commend you on the effort you put into helping this community. Regards, Steve. Edited December 28, 2017 by Smoke_Eater
Smoke_Eater Posted December 28, 2017 Author Posted December 28, 2017 I did some more testing and its not the syntax. ProtocolIO.lua is not receiving any UDP packets. I added some lines of code to ProtocolIO.lua to log the UDP messages to a log file, and nothing is logged. I even checked that everything would work by adding the line, self:rxbuf ="EPP_BATTERY_PWR 1\n" to simulate receiving this message, and the switch was set in the game, and the log file recorded the message. So, for some reason the UDP packets are not getting through. I will have to investigate if it's a send issue or a receive issue.
Omar Achraf Posted June 11, 2020 Posted June 11, 2020 hi Smoke_Eater, I was having same problem. I was using "localhost". After I changed to "127.0.0.1" my udp send message for P51D "PRIMER 1\n" worked. I'm coding with C#. My code is below: using System; using System.Net.Sockets; using System.Text; using System.Windows.Forms; namespace DCS_BIOS_Interf { class DCSSender { private const string DCS_BIOS_SEND_ADDRESS = "127.0.0.1"; private const int DCS_BIOS_SEND_PORT = 7778; UdpClient client = null; public void startSender() { client = new UdpClient(DCS_BIOS_SEND_ADDRESS, DCS_BIOS_SEND_PORT); } public void stopSender() { if (client != null) { client.Close(); } } public void send() { Byte[] sendBytes = Encoding.ASCII.GetBytes("PRIMER 1 \n"); try { client.Send(sendBytes, sendBytes.Length); } catch (Exception e) { MessageBox.Show(e.Message); } } } }
Recommended Posts