WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #10  
Old 06-27-2005, 10:36 PM
Johannes Johannes is offline
Member
 
Join Date: Jan 2005
Posts: 143
One question and a rather unstructured protocol of this night:

1) if I do
host = "localhost"
addr = (host,PORT)
InSocket.bind(addr)

should it not bind the socket to localhost?

Should I not be able to access it by
telnet localhost 49213

Where Port is 49213

I also tried the current IP-Adress e.g.
telnet 169.254.148.117 49213

--------------


The following is more like a protocol, maybe not very useful...

Tried a lot around to get a connection between Java and your Socket.


Port is 49213


Why do I not get a reply when I do


telnet 169.254.148.117 49213


Other Printouts:

COMPUTER_NAME OGL1
COMPUTER_NAME OGL1COMPUTER_IP_ADDRESS 169.254.148.117

I also tried (offline and online)
telnet localhost 49213

Only get connection failed.


From another Python Client I receive date: e.g.


from socket import *

# Set the socket parameters
host = "localhost"
port = 21567
buf = 1024
addr = (host,port)

# Create socket
UDPSock = socket(AF_INET,SOCK_DGRAM)

def_msg = "===Enter message to send to server===";
print "\n",def_msg

# Send messages
while (1):
data = raw_input('>> ')
if not data:
break
else:
if(UDPSock.sendto(data,addr)):
print "Sending message '",data,"'.....<done>"

# Close socket
UDPSock.close()


From Java it works if I use
try
{
DatagramSocket sock = new DatagramSocket();
InetAddress server = InetAddress.getByName(host);
if (timeout > 0)
sock.setSoTimeout(timeout * 1000); // millisec
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(System.out, true);
String line;
while ((line = "hallo12") != null)
{
byte[] req = line.getBytes(), ans = new byte[1024];
DatagramPacket r = new DatagramPacket(req, req.length, server, port), a = new DatagramPacket(ans, ans.length);
....

but normal Client-Sockets do not work e.g.
Socket kkSocket = null;
PrintWriter out = null;
BufferedReader in = null;
InetAddress server_name = null;

try
{
//InetAddress server_name=localhost.byN;
//String COMPUTER_NAME = ;
String host = "localhost";
InetAddress server = InetAddress.getByName(host);




kkSocket = new Socket(server, 21567);
out = new PrintWriter(kkSocket.getOutputStream(), true);
in = new BufferedReader(new InputStreamReader(kkSocket.getInputStream()));
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 04:33 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC