WinSock / Java Socket
Is it possible for a program created using winsock "talk" with another program created using Java socket?
thanks.
i see. do you guys know of any dowloadable code out there on the internet where i can try it out?
thanks.
thanks.
ok, i''m using java socket for the server & winsock for the client.
i accept input in the server through:
BufferedReader in;
in = new BufferedReader(new InputStreamReader(client.getInputStream()));
& then loops:
while(true)
{
System.out.println(in.readLine());
}
where client is of type Socket.
And then I send data in my client (using Winsock) with:
if ((nBytes = send(mySocket, (char*)&messageSize, sizeof(messageSize), 0)) == SOCKET_ERROR)
{
printf("Send Failed!\n");
}
my problem is, the server does not print on its own console the message that i sent with my client. my client doesn''t show the "Send Failed!" message, so it must''ve arrived to the Server...but the server isn''t showing the message I sent...
help!!!
Oh yeah, the client (winsock) successfully connects to the server since there is no error message when I am connecting and the server (javasocket) acknowledges the presence of the client.
i accept input in the server through:
BufferedReader in;
in = new BufferedReader(new InputStreamReader(client.getInputStream()));
& then loops:
while(true)
{
System.out.println(in.readLine());
}
where client is of type Socket.
And then I send data in my client (using Winsock) with:
if ((nBytes = send(mySocket, (char*)&messageSize, sizeof(messageSize), 0)) == SOCKET_ERROR)
{
printf("Send Failed!\n");
}
my problem is, the server does not print on its own console the message that i sent with my client. my client doesn''t show the "Send Failed!" message, so it must''ve arrived to the Server...but the server isn''t showing the message I sent...
help!!!
Oh yeah, the client (winsock) successfully connects to the server since there is no error message when I am connecting and the server (javasocket) acknowledges the presence of the client.
also, does anyone know how to get the IP address of the connecting clients?
like if my server uses java sockets, how do i get the IP address of the clients that connect to it? regardless if the client connects with java socket or winsock?
or if my server uses winsock, how do i get the IP address of the clients that connect to it? regardless if the client connects with java socket or winsock?
thanks.
like if my server uses java sockets, how do i get the IP address of the clients that connect to it? regardless if the client connects with java socket or winsock?
or if my server uses winsock, how do i get the IP address of the clients that connect to it? regardless if the client connects with java socket or winsock?
thanks.
I have written an eVB programme for the PDA server(winsock) and a java programme(java socket) for the desktop client.
However, only the server can initiate communication with the client and not the other way round. When I try to initiate communication using the Java programme, the message :REFUSE TO CONNECT appears. How do I solve this problem?
The Java programme works when I use it to initiate communication with another desktop.
HELPP
Thanks
However, only the server can initiate communication with the client and not the other way round. When I try to initiate communication using the Java programme, the message :REFUSE TO CONNECT appears. How do I solve this problem?
The Java programme works when I use it to initiate communication with another desktop.
HELPP
Thanks
The docs for BufferedReader.readLine() say:
Read a line of text. A line is considered to be terminated by any one of a line feed (''\n''), a carriage return (''\r''), or a carriage return followed immediately by a linefeed.
Are you sending a newline in your data from the client??
I also notice that the data you are sending is the variable ''messageSize'' which seems a pretty strange thing to call the data you want to send. I hope you didn''t paste that in from your source code...
Read a line of text. A line is considered to be terminated by any one of a line feed (''\n''), a carriage return (''\r''), or a carriage return followed immediately by a linefeed.
Are you sending a newline in your data from the client??
I also notice that the data you are sending is the variable ''messageSize'' which seems a pretty strange thing to call the data you want to send. I hope you didn''t paste that in from your source code...
I am a newbie in Java so I guess my code looks wierd.In between,
I am still working on the message sending part of my code.
I just manage initiate connection from Java by interchanging 2 lines of my eVB code.
Problem:
The connection can only be initiated once.After disconnecting the first connection, I am unable to reconnect.
What should I do?
I am still working on the message sending part of my code.
I just manage initiate connection from Java by interchanging 2 lines of my eVB code.
Problem:
The connection can only be initiated once.After disconnecting the first connection, I am unable to reconnect.
What should I do?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement