Sunday, December 1, 2013

IPhone and Java Socket communication problems to consult.

questions are as follows:
1, iPhone's Socket with Java / Android write Socket communication with connections?

2, Java uses a custom User class package, use ObjectOutputStream.WriteObject () output,

The iPhone also can encapsulate a User class do? Object and how to receive a stream of bytes you? iPhone can also strongly into User type it?

Rookie advice, thank you answer ~

Reply:
I believe that you are a rookie. socket communications and language platform does not matter. As long as your java program open ports, iPhone will be able to connect. And vice versa. java and socket programming related I will not say. iPhone and socket programming related AsyncSocket you can look at this open source library, very easy to use, mac below, http, socket programming platform is the easiest to use I've seen of it. Very powerful, very simple to use.
Reply:
cited a floor reply:
I believe that you are a rookie. socket communications and language platform does not matter. As long as your java program open ports, iPhone will be able to connect. And vice versa. java and socket programming related I will not say. iPhone and socket programming related AsyncSocket you can look at this open source library, very easy to use, mac below, http, socket programming platform is the easiest to use I've seen of it. Very powerful, very simple to use.


Use ObjectOutputStream.WriteObject () output of a custom wrapper classes, such as receiving a User class that defines the private
String name them. .
If the iPhone received, how re-opened it? IPhone is also packaged in such a class do? You can then turn the strong type it? ? This clearance is not related to the basic data types in different programming memory length? ?
Reply:
You can Google some of subcontracting, stick pack, and so on the basis of the article to see the program again. If you're going to learn iPhone development, infrastructure is critical. Because the future may be several cross-platform programming. These platforms only principle, only tcp / ip protocol is the same. As to the question of the length of the data type, the data packets are data transfer byte, packet length also be transmitted to the target platform, the re-conversion.
Reply:
Upstairs that has been very clear ... I think I should explain results like him .... You'd better know what the next socket is not it ...
I can only tell you that one is cross-platform communication http socket one is there webservice .... The three most commonly used .... There are many other ways ..... you are interested you can own more than look
Reply:
I mean is this fact. . .

1, the server is written in Java, by ObjectOutputStream.writeObject () output is the custom MPackage chat message data packets.


Code is roughly as follows:


public class MPackage implements Serializable {
private String from;
private String to;
private Object message;
private PackType packType;

}


2, then use the iPhone client receives this byte stream, how to convert it?


Objective - C There is no readObject () this way?


Assuming receives this byte stream, you can customize a MPackage class received byte stream can be as strong as Java into MPackage use it?

Reply:
No readObject () this method can not be strong rpm. If you are using tcp transport bag, you can not even received a few objects you can not understand, you have a strong turn.
Reply:
No readObject () this method can not be strong rpm. If you are using tcp transport bag, you can not even received a few objects you can not understand, you have a strong turn.
Reply:
reference to the 7th floor of replies:
no readObject () this method can not be strong turn. If you are using tcp transport bag, you can not even received a few objects you can not understand, you have a strong turn.


There are several objects know, Java is the case, so we do not know how to develop iPhone compatible. .

No comments:

Post a Comment