Jump to content

Search the Community

Showing results for tags 'java plc pcom'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Our Community
    • Come on in!
  • News and Announcements
    • Latest Release! UniLogic V1.28 introduces Motion: Servos & Motors plus OPC UA server!
    • VisiLogic:9.8.64 - Link to mobile app, Ladder: 2x the Space!
    • New!!! ***** U90 Ladder*****
  • UniStream HMI + PLC Programmable Controllers & UniLogic Software
    • UniStream: Hardware
    • UniLogic Software
    • UniLogic UDFBs
    • Industry 4.0, IioT, MQTT, OPC UA
  • Vision, Samba, Jazz and M90 PLC + HMIs & Software
    • Vision & Samba PLC + HMI Controllers & VisiLogic Software
    • Jazz, M91 PLCs and U90Ladder
  • Software Utilities
    • SD Card Suite
    • Remote Operator
    • Remote Access
    • DataXport and DataXls
    • UniDownloader
    • UniOPC
    • UniDDE
  • Utilities for .net and Visual Studio
    • Unitronics PCOM Protocol
    • COM Object ActiveX .dll
    • .NET driver
  • Project Design
    • ...I have a project...what hardware do I need?
  • User Application Stories
    • Just finished a great project?
  • Tips and Tricks
    • Best Programming Practices
    • Tips and Tricks
  • Job Board
    • Projects seeking Programmers
    • Programmers seeking Projects
  • General Discussion
    • We're Listening...
    • The Lounge
  • News and Announcements Copy

Blogs

  • Unitronics' Blog: PLCs, HMIs and more
  • Saragani's Blog
  • Simon's Blog
  • Ash Neilson's Blog
  • Joe Tauser's Blog
  • Unitronics en Español
  • Powered by AMPS
  • Alldrives UK's Blog
  • Unitronics, Howman Style
  • PLCNewbie's Blog
  • Telestar Automation Blog
  • Webinars Collection
  • Tim's Corner
  • Blog
  • TELESTAR (Italian)
  • i4 Automation
  • i4 Automation (UK)
  • Unistream UDFB's

Categories

  • From Headquarters: Sample Applications
    • From Headquarters: VisiLogic
    • From Unitronics: U90 Ladder applications
  • User-submitted Applications
    • From Users: VisiLogic applications
    • From Users: U90 Applications

Categories

  • Articles
    • Forum Integration
    • Frontpage
  • Pages
  • Miscellaneous
    • Databases
    • Templates
    • Media

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 1 result

  1. Hello. I am unable to get any information from PLC using Java currently. It does manage to connect to it though, as while the application is running and socket is connected, no other software can communicate with plc. I have spent a better part of my day trying to get my Java application to communicate with PLC but without much. I also haven't found any information regarding Java Unitronics driver so i guess there isn't one? I would appreciate any kind of help. Code below. Cheers, Ardi Vaba import java.io.*; import java.net.Socket; import java.nio.ByteBuffer; public class asd { private static final String HOST = "192.168.1.74"; private static final int PORT = 20256; public static void main(String[] args) throws IOException { Socket socket = new Socket(HOST, PORT); //I still don't underastand what [0] and [1] are for... byte[] tcpHeader = new byte[6]; tcpHeader[0] = 1; //??? tcpHeader[1] = 0; //??? tcpHeader[2] = 101; //Ascii comm type tcpHeader[3] = 0; tcpHeader[4] = 14; ///01RE0020051F + CRC = 14 tcpHeader[5] = 0; String message = "/01RE0020051F\n"; byte[] finalMessage = new byte[message.getBytes("ASCII").length + tcpHeader.length]; //Let's add messange and hader together... ByteBuffer buffer = ByteBuffer.wrap(finalMessage); buffer.put(tcpHeader); buffer.put(message.getBytes("ASCII")); //Let's wait until socket is connected...just to be sure while(!socket.isConnected()){} System.out.println("Sending ascii message..."); //Send the message socket.getOutputStream().write(finalMessage); //Start waiting for response... BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream())); System.out.println("Starting to wait for response..."); String response = ""; while((response = reader.readLine()) != null) { System.out.println(response); } } } Updated code to more readable format...
×
×
  • Create New...