Multicast Sender and Receiver code problem

Hi
I am developing a multicast chat program. I am using codes from a well known book "Java Network Programming". I have run both programs 'MulticastSniffer' and 'MulticastSender'
MulticastSniffer runs OK but MulticastSender gives me the error below:
java.lang.NumberFormatException: null
Usage: java MulticastSender multicast_address port ttl
I cant figure out the error. Could some one please help me here to find the error. I have put both programs below: Thanks
Here is the code for MulticastSniffer.java
import java.net.*;
import java.io.*;
public class MulticastSniffer {
public static void main(String[] args) {
InetAddress group = null;
int port = 0;
// read the address from the command line
try {
group = InetAddress.getByName("235.0.0.1");
port = Integer.parseInt("8192");
} // end try
catch (Exception e) {
// ArrayIndexOutOfBoundsException, NumberFormatException,
// or UnknownHostException
System.err.println(
"Usage: java MulticastSniffer multicast_address port");
System.exit(1);
MulticastSocket ms = null;
try {
ms = new MulticastSocket(port);
ms.joinGroup(group);
byte[] buffer = new byte[8192];
while (true) {
DatagramPacket dp = new DatagramPacket(buffer, buffer.length);
ms.receive(dp);
String s = new String(dp.getData());
System.out.println(s);
catch (IOException e) {
System.err.println(e);
finally {
if (ms != null) {
try {
ms.leaveGroup(group);
ms.close();
catch (IOException e) {}
Here is the code for MulticastSender
import java.net.*;
import java.io.*;
public class MulticastSender {
public static void main(String[] args) {
InetAddress ia = null;
int port = 4445;
byte ttl = (byte) 1;
// read the address from the command line
try {
ia = InetAddress.getByName("235.0.0.1");
port = Integer.parseInt(null,4445);
if (args.length > 2) ttl = (byte) Integer.parseInt("8192");
catch (Exception e) {
System.err.println(e);
System.err.println(
"Usage: java MulticastSender multicast_address port ttl");
System.exit(1);
byte[] data = "Here's some multicast data\r\n".getBytes();
DatagramPacket dp = new DatagramPacket(data, data.length, ia, port);
try {
MulticastSocket ms = new MulticastSocket();
for (int i = 1; i < 10; i++) {
ms.send(dp, ttl);
ms.close();
catch (SocketException se) {
System.err.println(se);
catch (IOException ie) {
System.err.println(ie);
I will appreciate your help

Hi kdajani thanks for reply
It doesnt give any line number or doesnt tell where the error is.
after i run the program it gives error below. if you run the program you will see what happens.
java.lang.NumberFormatException: null
Usage: java MulticastSender multicast_address port ttl
And
according to the reply from sabre150 , I have tried using
port = Integer.parseInt(null,"4445");
using above code gives the error below
MulticastSender.java:18: cannot find symbol
symbol : method parseInt(<nulltype>,java.lang.String)
location: class java.lang.Integer
port = Integer.parseInt(null,"4445");
and
port = 4445;
using this does not execute at all
They dont work either.
Thanks you all

Similar Messages

  • Sending and receiving sms problem

    Hi,
    I try to send and receive message with this command;
    MessageConnection conn = (MessageConnection) Connector.open("sms://" + addr);
    When I run this command, I meet this error:
    java.lang.UnsatisfiedLinkError: isNetworkMonitorActive
         at javax.microedition.io.Connector.isNetworkMonitorActive(Native Method)
         at javax.microedition.io.Connector.<clinit>(Connector.java:142)
         at com.sezo.smsyeni.Sms.sendText(Sms.java:36)
         at com.sezo.smsyeni.Sms.main(Sms.java:24)
    I want to send sms over IR with my phone. (Sony Ericsson K500i)
    Is it necessary to use any API?
    What should I do?
    Thanks.

    Hi Friends,
    I'm new in the J2ME domain. I did try to send SMS from my desktop application to mobile. But at runtime I'm getting the following error:-
    ++++++++++++++++++++++++++++++++++++++++++
    java.lang.UnsatisfiedLinkError: isNetworkMonitorActive
    at javax.microedition.io.Connector.isNetworkMonitorActive(Native Method)
    at javax.microedition.io.Connector.<clinit>(Connector.java:142)
    at MessageSender.main(MessageSender.java:12)
    +++++++++++++++++++++++++++++++++++++++++++++++
    Please let me know what all setup/configuration/dll are required to resolve the problem. Appreciate your input.
    Thanks and Regards,
    -AshokM

  • Sending and receiving email problem

    for three months I have been unable to receive and send emails.  Is this just a storage problem and if so is there an alternative to buying more storage space?
    Thanks,
    not happy iCloud customer

    Hello iCloudsti"ks,
    Thank you for contacting Apple Support Communities.
    It's hard to say from the limited information what could be causing your issues. You can use the following article to troubleshoot your send/receive issues with iCloud mail:
    iCloud: Troubleshooting iCloud Mail
    http://support.apple.com/kb/TS4002
    Regards,
    Jeff D.

  • Code to automatically sms send and receive by sql server

    I want you to tell me the necessary code in vb and sql to automatically send and receive sms from sql database.i know only that i have to create one table for it in the database.please anybody who knows post the code for me.

    Hi mintesnot h.benti,
    According to your description, since the issue regards VB code, as other post, you need to post the related problem on Visual Basic forum at
    http://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=vbgeneral. It is appropriate and more experts will assist you.
    In addition, if you want to use a SQL Server database, and it makes SMS sending and receiving possible through database tables in your VB.NET application. You may need to use the 3<sup>rd</sup> tools, such as OZEKI NG SMS Gateway or others.
    http://www.ozekisms.com/php-sms-api-asp-sms-A/index.php?owpn=586&sms_gateway=sms_VB.NET_database_sms_example_guide
    Note: Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality,
    safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and please be cautious and ensure you have completely understood the risk before retrieving any software from the
    Internet.
    Regards,
    Sofiya Li
    Sofiya Li
    TechNet Community Support

  • Problem with Send and Receive Emal In SAP System

    Hi gurus!
    I have a following quote:
    Dear !
    I have a problem with send and receive email in SAP system following :
    I want to test send and receive email in local network at my company. I
    had two server
    Server 1 : I setup Exchange Mail Server 2007 with domain controller is
    fes.com
    Server 2 : I setup SAP ERP ECC 6.0
    On Server 1 : I created 2 account ( u1Afes.com and u2Afes.com ) and then I tested send and receive email between u1 and u2 in local network through Microsoft Outlook 2007 -> OK
    and then
    On Server 2: I had configured send and receive email on SAP system
    through tcode SBWP, SCOT and SOST as Note 455140 - "Configuration of
    e-mail, fax, paging or SMS using SMTP"
    for example :
    I logged in SAP system with user Basis01 (with email u1Afes.com ) -> then,using tcode SBWP -> new message -> send to u2Afes.com with Internet Mail type and then status message with green light -> sending ok
    and then I have used Microsoft Outlook 2007, I logged with account u2 ->check email -> Ok. I saw message which send from u1
    Finally, My problem is how can receive mail in SAP system without using Microsoft Outlook
    For example:
    Login system SAP with Basis01 account (with  u1Afes.com ) -> tcode SBWP ->New Message -> send to u2Afes.com
    and then
    Login system SAP with Basis02 account (with u2Afes.com ) -> tcode ??? ->
    To receive email from Basis01 (with u1Afes.com )
    Please help me now
    Thanks
    I replace "@" with "A" because of banning email of this forum.
    This quote is about sending email in local network. And we can't receive any email from the outside email address. Addition if I wanna send email to internal email in Internet (we've just tried with email address in local network) What should I config in SAP and Exchange ?
    By the way, Is SAP Server IP added to Relay Agent for sending or receiving mail ?
    Regards
    An NLP
    Edited by: An NLP on Apr 6, 2010 7:03 PM

    Hi,
    This problem is a classic problem of mail routing via Exchange. Exchange like most mail servers use the domain part of the email address as a means to route mails. So I will make an assumption that your main company mail addrss is "User @ fes.com".
    So when you send a mail to the "User @ fes.com mail" address the mail is delivered to your Outlook mail address as this is the default route for company.
    (Q) So how do you get your Exchange server to relay the mail into the sending SAP system?
    (A) The easiest way would be to setup and unique mail domain for your SAP system. I always recommend "user @ client.sid.company.com" which in your case would be "u1 @ 100.PRD.fes.com". You can then instruct Exchange to send any emails addressed to 100.PRD.fes.com domain to your SAP system. Also using this format of address you can configure multiple mail connections into multiple SAP systems.
    (A) Another answer would be to enter the "Full" email address (LOcal and Domain part of address) into the routing rule for Exchange e.g. "U1 @ fes.com" so that all emails addressed to this user will be delivered into SAP. However this method requires a lot of Admin as you will have to update Exchange with ALL email address that need to receive emails. Also if your corporate mail address is "U1 @ fes.com" then all mails will be forwarded to SAP.
    I would definitely NOT recommend this method but the decision is up to you.
    P.S. The IP address of the SAP system is entered into the mail header of the email. This is standard practice in SMTP relay. You can suppress this header in Exchange
    Hope this helps
    Michael

  • Problem with sending and receiving e-mail through exchange [GMail]

    Hello I have problem with sending and receiving e-mail.
    all is well set, username and password are correct, the server set m.google.com. verification of data is about like stepping into a post and want to check the post office gives me an error message: Can not Get Mail. The connection to the server has failed
    I have this problem on my two iPhone

    http://www.zdnet.com/google-drops-exchange-activesync-support-for-free-email-acc ounts-7000008836/

  • HT4628 I am able to download updates and send and receive email so I know I have connection to my wireless router. However, when I click on Safari, I get the message "Safari quit unexpectedly." What is my problem and how do I solve?

    When I click on Safari, I get the message "Safari quit unexpectedly." I know I have access to my wireless net work because I just found and downloaded updates and can send and receive mail. What is my problem and hoe is it solved?

    As Outlook is not an Apple product, you will find more helpers familiar with Outlook here:
    Office for Mac forums

  • I have a new iPhone 6 plus and all is OK. But the mail shows more than 400 'unread' messages whereas there are none in the mailbox or trash or anywhere else I have looked. I can send and receive with no problem. I'm sure I have no unread messages.

    I have a new iPhone 6 plus and all is OK. But the mail shows more than 400 'unread' messages whereas there are none in the mailbox or trash or anywhere else I have looked. I can send and receive with no problem. I'm sure I have no unread messages.

        jsavage9621,
    It pains me to hear about your experience with the Home Phone Connect.  This device usually works seamlessly and is a great alternative to a landline phone.  It sounds like we've done our fair share of work on your account here.  I'm going to go ahead and send you a Private Message so that we can access your account and review any open tickets for you.  I look forward to speaking with you.
    TrevorC_VZW
    Follow us on Twitter @VZWSupport

  • Problem with Stored Procedure exection in Sender and Receiver side of JDBC

    Hi All,
    I am facing problem while executing Stored Procedures using sender and receiver sides of JDBC adapter.
    Here is my SP in Oracle DB :
    PROCEDURE EMP                           
    ( ID IN VARCHAR2,NAME IN VARCHAR2,PROCESSED IN VARCHAR2  ) AS                                                          
    BEGIN                                                         
       INSERT INTO EMPLOYEE VALUES (ID, NAME, PROCESSED);COMMIT;END EMP;
    Now I want to execute this SP using sender JDBC channel and receiver JDBC channel.
    Can anyone please help me executing this SP?
    Regards,
    Soorya

    Hi Soorya,
    The receiver Data type should be like this:
    <StatementName>
    <storedProcedureName action=u201D EXECUTEu201D>
        <table>realStoredProcedureeName</table>
    <param1 [isInput=u201Dtrueu201D] [isOutput=true] type=SQLDatatype>val1</param1>
    </storedProcedureName >
      </StatementName>
    Check the link http://help.sap.com/saphelp_nw04/helpdata/en/64/ce4e886334ec4ea7c2712e11cc567c/frameset.htm
    Which DB  are you using?? The sender structure will be like
    <resultset>
    <row>
    <field1></field1>
    <field2></field2>
    <field3></ field3>
    </row>
    </resultset>
    Search SDN you will get lot of examples
    Regards
    Suraj

  • Hello! Im having problems about my Iphone showing NO SERVICE on top. Im not able to send and receive msg, same with calls

    Hello Guys! I hope someone could help me, Im having trouble with my phone's signal, I am not able to send and receive msgs, same as make calls and receive calls. At first, my phone is working fine (iphone 4, iOS 7.0.4) and all of a sudden, my text messages are not getting through, and I noticed that my phone shows NO SERVICE, I refreshed the phone by turning it off and turning it on after a couple of minutes, it worked. My phone is okay again after that, Im able to send and receive messages again. But after few hours, the problem came again. NO SERVICE sign is displayed again, but this time after refreshing the phone nothing good happened. I tried almost every possible thing I can to fix it but it doesn't work. What should I do.
    Thank you

    Hey Clara,
    These are the recommended troubleshooting steps to resolve No Service issues on iPhone:
    Toggle airplane mode: Tap Settings > Enable Airplane Mode, wait five seconds, then turn off airplane mode.
    Turn iPhone off and then on again.
    Remove the SIM card and verify that it's a valid, carrier-manufactured SIM. Also verify that it isn't damaged, worn, or modified. Then reinsert it.
    Check for a carrier-settings update. Connect to a Wi-Fi network. Then tap Settings > General > About. If an update is available, iOS will ask you if you want to install it. If Wi-Fi isn't available, connect your device to iTunes.
    Update your iPhone to the latest version of iOS.
    Reset network settings by tapping Settings > General > Reset > Reset Network Settings. This will reset all network settings, including Bluetooth pairing records, Wi-Fi passwords, VPN, and APN settings.
    Restore the iPhone.
    If you are outside the United States, please also follow these steps:
    Go to Settings > Carrier > Automatic.
    If the phone registers any carrier network, Settings > Carrier will be present.
    If the Carrier option is missing in Settings and you are outside of the Unites States, please contact Apple for support and service options.
    Set the option for Automatic to off.
    A list of potentially available carriers appears after about two minutes. If the device is locked to a carrier, it may connect only to the carrier network to which it is locked. If the device displays carrier networks, then the device is working as expected.
    Set Settings > Carrier > Automatic back to on.
    If you're still experiencing No Service issues, contact your carrier to check for any network or account issues that could cause these symptoms.
    from: iPhone: Troubleshooting No Service
    http://support.apple.com/kb/TS4429
    Welcome to Apple Support Communities!
    Take care,
    Delgadoh

  • Code to retrive the sender and receiver interface names using custome adapter module

    Hello Team,
    I want to develop an custom adapter module which could retrieve the names of the sender and receiver interfaces of the scenario and for that i am trying to use com.sap.aii.af.service.administration.api.monitoring.ProcessContextFactory.ParamSet but i don't know whether this API will support or not and also i don't know how to develop the code using this API so please suggest me some code for it so that i could retrieve the names.
    Thanks you all in advance.
    Regards,
    Avinash.   

    Hi,
    Just ASMA setting will do the needful. Are you planning to rename your target file name. If yes then only you will require UDF.
    Update: Since your directory name will be taken from source file name then you have to use mapping for this, else it will not be possible.
    I don't know if creating a new module for this will help you solve the issue, but in that case rather creating adapter module, mapping will be easier.
    Regards,
    Sarvesh
    Edited by: Sarvesh Singh on Dec 7, 2009 3:04 PM

  • My iphone 4 did not make call. It can receive calls, send and receive sms, internet is working. How can I solve this problem?

    My iphone 4 did not make calls but I receive calls, send and receive sms, emails, etc. How may I solve it?

    I am having the same problem with ios 4.3.5

  • Another send and receive problem

    We have three accounts setup on our iMac. Mine, my wife, and our children.
    My account and the kids have no problem sending or recieving email. But my wife can only send and receive emails hit and miss. We are all using the same pop account, so I have those setting correct. Some times she gets the prompt asking to retry send. Some times it just takes them off line.
    Any ideas?

    The easiest fix would be to just use safari and a webmail interface.
    For example, I have yahoo in my mail app. But on some internet connections it just won't work, so I use safari to get to yahoo.com and access my mail that way.
    Your mail provider should have a web interface and you could use that.

  • TS3276 I have no sound on my MacBook Air for sending and receiving messages. All sound settings have been checked and are OK. This problem has arisen many times and is intermittent in the sense that the sound returns and disappears for no apparent reason.

    I have no sound on my MacBook Air for sending and receiving messages. All sound settings have been checked and are OK. This problem has arisen many times and is intermittent in the sense that the sound returns and disappears for no apparent reason.

    Open System Preferences > Sound > Sound Effects
    Select:  Play user interface sound effects
    And make sure the Mute box is not selected.
    Now open Mail. From the Mail menu bar clik Mail > Preferences then select the General tab.
    Make a selection from the:  New messages sound  pop up menu.

  • I am using systec usbmodule1 to send and receive CAN messages , is any one have tried this in labview?, if yes can you send me the code thanks

    i am using systec usbmodule1 to send and receive CAN messages , is any one have tried this in labview?, if yes can you send me the code
    thanks
    Solved!
    Go to Solution.

    Hey,
     All of our CAN drivers have been written for National Instruments' CAN hardware (referenced here : http://digital.ni.com/public.nsf/allkb/E2C6ED025C7​98C5586256F4E00520448 ). Thus, you will have to code all your communication manually, unless Systec provides a LabVIEW driver. There might be various dll files that Systec provides for communication, which you will be able to access through LabVIEW. Take a look at the Call Library Function Node, which can be found from the Functions Palette under Connectivity -> Libraries & Executables. Here you can call a dll file, and also the individual functions within that dll.
    I would suggest posting your question either to the LabVIEW forum, as previously mentioned, or to the CAN forum found here : http://forums.ni.com/ni/board?board.id=30
    Justin E
    National Instruments R&D

Maybe you are looking for

  • 2 macs share same hard drive?

    I need help with a solution. I need to use older Adobe Software (LiveMotion) Unfortunately, it does not work with OS X beyond 10.3. I want to use the new OS X on my G5. I want to use one of my older Macs, I have a G4 and a G3, (would prefer to use G3

  • How can I check the locV of a sprite on every frame?

    I'd like to know how can I tell Director, in Lingo, to check the position of a sprite in every frame in order to use that position to set the value of a global variable. I want to avoid having an on enterFrame script on every frame as I will need to

  • Binding to selectOneMenu

    Hi I have having problems binding my selectOneMenu (myfaces), exception is argument type mismatch. <h:selectOneMenu         id="roles_comp"         value="#{flowScope.userViewController.user.role.uuid}"           valueChangeListener="#{flowScope.user

  • Data set is not refreshing while preview in visual studio 2010

    Hi, Dataset is not refreshing the fields while preview the data. always I need to go to dataset-->query there I need to upadate it. But I need to uupdate it dynamically in ssrs. I tried with Auto refresh option in report properties not getting expect

  • HT4439 Can i upgrade from OS X 10.6.4 to a later OS version?

    Can i upgrade from OS X 10.6.4 to a later OS X version? I cannot install the JAVA version that i require.