⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 clientwithsr.java

📁 A byte comunication system made in java that can be used to send messages in betweeen computers on t
💻 JAVA
字号:
import ByteSendReceive.*;
import MessageMarshaller.*;
import Registry.*;
import Commons.Address;

public class ClientWithSR
{
	public static void main(String args[])
	{
		new Configuration();

                Address dest=Registry.instance().get("Server");

		Message msg= new Message("Client1","How are you");

		ByteSender cs = new ByteSender("Client1");
		
		Marshaller m = new Marshaller();
			
		byte[] bytes = m.marshal(msg);

		cs.deliver(dest, bytes);

                Address myAddr = Registry.instance().get("Client1");
	
		ByteReceiver cr = new ByteReceiver("Client1", myAddr);
            
                bytes=cr.receive(); 

		Message answer = m.unmarshal(bytes);

		System.out.println("Client received message "+answer.data+" from "+answer.sender);
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -