<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- WARNING: Eclipse auto-generated file.
Any modifications will be overwritten.
To include a user specific buildfile here, simply create one in the same
directory with the processing instruction <?eclipse.ant.import?>
as the first entry and export the buildfile again. --><project name="AntiCheat" default="dist" basedir=".">
<description>
simplest example build file
</description>
<!-- set global properties for this build -->
<property name="src" location="src" />
<property name="build" location="build" />
<property name="dist" location="dist" />
<property name="version" value="1.0" />
<target name="init">
<!-- Create the time stamp -->
<tstamp />
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}" />
</target>
<target name="compile" depends="init" description="compile the source">
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${src}" destdir="${build}" />
</target>
<target name="dist" depends="compile" description="generate the distribution">
<buildnumber />
<!-- Create the distribution directory -->
<mkdir dir="${dist}/lib" />
<!-- Put everything in ${build} into the MyApplication-${version}.${build.number}.jar -->
<jar destfile="${dist}/lib/MyApplication-${version}.${build.number}.jar" basedir="${build}" />
</target>
<target name="clean" description="clean up">
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build}" />
<delete dir="${dist}" />
</target>
</project>
3条答案
按热度按时间gab6jxml1#
主要的问题是,你需要非常小心地对待你发送和接收的数据的编码。这里有两个程序一起工作。C#客户端发送一个字符串,首先发送它的整数长度,然后发送字符串本身的字节数。Java服务器读取长度,然后读取消息并打印输出到控制台。然后组成一个回送消息。计算它的长度,提取字节并将其发送回C#客户端。客户端读取长度,消息并打印输出。应该有一种方法来避免所有按位的东西,但老实说,我对这些东西有点生疏,特别是在Java方面。
Java服务器:
C#客户端:
63lcw9qa2#
我想知道如何循环这个方法,这样你就可以一遍又一遍地发送客户端消息。如果你觉得这个有用,请告诉我。我用导出Ant脚本在Eclipse上构建这个。我也会包括Ant脚本
Ant脚本:
yqlxgs2m3#
我在这里编码的是一个高级和改进版本的
验证码:https://stackoverflow.com/a/14825061/13883478
is = Socket的输入流。
Java端接收数据的标签/标记:
过程数据示例:
}
C#端用打包器发送数据: