check out object stream

I want to use both socket type , string and object stream.

sometime the socket will receive the data consists of String and sometime object.

It has to be just one port used.

so ,

I have to know the data in socket is String or object stream.
Is there way to check it out?

How can I solve this out?
gamjaradioAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
for_yanConnect With a Mentor Commented:
Do you really have many places where you are sending and receiveing them bothe wyas where you need to change?
Post the code how you do it in each case, maybe we could think of some way to minimize changes
Do you have big numbers of both cases?
0
 
ksivananthConnect With a Mentor Commented:
can't you make the strings be sent as object?
0
 
gamjaradioAuthor Commented:
of course it is possbile.
but , there are so many code that I have to change.
0
 
ksivananthConnect With a Mentor Commented:
>>but , there are so many code that I have to change.

I think, the only place where you'll have to make change is while writing and extracting data
0
 
for_yanConnect With a Mentor Commented:
Sure, you transmit ObjectStream and when you get back Object using instanceof operator
check all possible types to which Object can belong  including String and other possible objects which you'll transmit. You can create such method and replcae in all places
0
All Courses

From novice to tech pro — start learning today.